Simple Calculator

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2008
Posts: 9
Reputation: mikedd is an unknown quantity at this point 
Solved Threads: 0
mikedd mikedd is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #11
Aug 21st, 2008
but the output above will printout an 'a' output.How do i make it to printout the word ninety seven?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Simple Calculator

 
0
  #12
Aug 21st, 2008
  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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 14
Reputation: mike_g is an unknown quantity at this point 
Solved Threads: 3
mike_g mike_g is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #13
Aug 22nd, 2008
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 :/
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 9
Reputation: mikedd is an unknown quantity at this point 
Solved Threads: 0
mikedd mikedd is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #14
Aug 22nd, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Simple Calculator

 
0
  #15
Aug 22nd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 9
Reputation: mikedd is an unknown quantity at this point 
Solved Threads: 0
mikedd mikedd is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #16
Aug 22nd, 2008
yay finally i did it but i still facing problem on the decimal number.Gt any good idea to solve it?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 14
Reputation: mike_g is an unknown quantity at this point 
Solved Threads: 3
mike_g mike_g is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #17
Aug 22nd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 9
Reputation: mikedd is an unknown quantity at this point 
Solved Threads: 0
mikedd mikedd is offline Offline
Newbie Poster

Re: Simple Calculator

 
0
  #18
Aug 23rd, 2008
...Cmon la tel me how to make the decimal putput tat read the output point zero one?
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,033
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Simple Calculator

 
0
  #19
Aug 23rd, 2008
Originally Posted by mikedd View Post
...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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Simple Calculator

 
0
  #20
Aug 23rd, 2008
> .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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC