Showing posts with label C++. Show all posts
Showing posts with label C++. Show all posts

Monday, May 31, 2010

Word Reverse in C.

Hello, We've got another problem or should we say a challenge to solve coming from a site which I've been searching for puzzle and stuff. And suddenly I've seen this problem that reminds me of my Freshmen days when I was still on college. I remember the days when I was like. "Whoa?!, what is this stuff?". We'll that's my first impression on Turbo C. So Antique. But my late professor says, "If you want to be a good programmer, Don't forget the basic". And I will never forget that. All hail Prof. Juanito Doctor of De La Salle University DasmariƱas!

Here's the Problem:

Write a program that inputs a string of keyboard characters and outputs the characters in reverse order.

We'll, It's string manipulation time. We will use Arrays and Conditionals to solve this. We need to Exchange the first character to the last character of the string. Then the second character to the second to the last character of the string and etc. Like this....



Read more...

Saturday, May 29, 2010

Divisors of a Number

Hello guys! I've received another email from one of my colleagues in an Online game called Trickster. Here is her email.

Hi Jerome,

Heya Jumi! My professor gave us a homework in programming. Here's the question:

Write a program in C that will list all the proper divisor of a number excluding itself.

Example:

Input: 8
Output: 1,2,4

I'm already picturing in my mind what I have to do but I can't write the proper code for it. Please help.

Much love,
Rose 

Well Rose, Instead of replying to your email, I've decided to post your question on my blog to help other people as well. And yeah, Thank you for emailing me this.

By the way, I've accidentally deleted my Turbo C on my PC and I have to download it again. I searched google and found a site that needs you to register to download Turbo C and I found that very unnecessary. So for you guys that needs Turbo C. Here it is. Turbo C.



Read more...

Wednesday, May 26, 2010

Fibonacci

Alright, I've just received my first email coming from Von Espiritu of Quezon City.

Sir,

My college professor wants us to make a program in C that will take an input and make a Fibonacci until it reaches the number input-ed integer. I hope you might help me in my problem because it is our last exercise, indeed a make or break activity for my summer class.

Thanks,
Von Espiritu

Alright, First of all. Von, I am really glad that you emailed me. You're my first email sender by the way. And I am really  grateful to share my solution with you. My college professor also assigned us an activity for fibonacci but it's coded using java. But hey, We programmers don't contain ourselves on a programming languages. We explore more and more. And as long as you have the idea and you know the syntax. You basically can do anything! So cheers to that Von!



Alright. We are going to right this on C. The very first programming language I've learned. I'll just give you the body though, and explain the codes line by line.


Read more...