943,879 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 3984
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Aug 21st, 2008
0

Re: Simple Calculator

but the output above will printout an 'a' output.How do i make it to printout the word ninety seven?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mikedd is offline Offline
9 posts
since Aug 2008
Aug 21st, 2008
0

Re: Simple Calculator

  1. char *ones[ ] = { "zero", "one", "two", "three" };
  2. char *tens[ ] = { "none", "ten", "twenty" };
  3. int n = 23;
  4. printf( "%s %s", ones[n%10], tens[n/10] );
It's too big a clue to explain, you'll just have to figure it out.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 22nd, 2008
0

Re: Simple Calculator

Since the result is a float I still reckon the easiest way to go about it would be to use sprintf and parse the string, but the op dosent seem to be interested in that idea :/
Reputation Points: 12
Solved Threads: 3
Newbie Poster
mike_g is offline Offline
14 posts
since Jul 2008
Aug 22nd, 2008
0

Re: Simple Calculator

but the output above is an 'a'.how do i program it to make the output ninety seven?pls ignore this msg..i post wrongly oredi
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mikedd is offline Offline
9 posts
since Aug 2008
Aug 22nd, 2008
0

Re: Simple Calculator

So that's all you've got to show for another day's help, and maybe you thinking about the problem some more (or maybe - shock horror - actually trying something for yourself).

Just post the same question again.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 22nd, 2008
0

Re: Simple Calculator

yay finally i did it but i still facing problem on the decimal number.Gt any good idea to solve it?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mikedd is offline Offline
9 posts
since Aug 2008
Aug 22nd, 2008
0

Re: Simple Calculator

Yes, but first you are going to have to learn how to read. You could practice with this. Then learn how to converse with other people coherently. Hopefully the reading material should help you with that too.
Reputation Points: 12
Solved Threads: 3
Newbie Poster
mike_g is offline Offline
14 posts
since Jul 2008
Aug 23rd, 2008
0

Re: Simple Calculator

...Cmon la tel me how to make the decimal putput tat read the output point zero one?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mikedd is offline Offline
9 posts
since Aug 2008
Aug 23rd, 2008
0

Re: Simple Calculator

Click to Expand / Collapse  Quote originally posted by mikedd ...
...Cmon la tel me how to make the decimal putput tat read the output point zero one?
I knew I should have keep my copy of the Rosetta Stone.
Aia
Reputation Points: 2224
Solved Threads: 218
Nearly a Posting Maven
Aia is offline Offline
2,304 posts
since Dec 2006
Aug 23rd, 2008
0

Re: Simple Calculator

> .Gt any good idea to solve it?
Yeah, exactly the same way that you solved the part before the decimal point.
It's all the same technique.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: please help me with pointer to structures
Next Thread in C Forum Timeline: greatest of three nos





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC