Please help me fix these errors

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

Join Date: Dec 2008
Posts: 40
Reputation: RenFromPenn is an unknown quantity at this point 
Solved Threads: 0
RenFromPenn RenFromPenn is offline Offline
Light Poster

Re: Please help me fix these errors

 
0
  #11
Jan 4th, 2009
*Sigh* Okay, but could we please get back to trying to work this out. I'm at a total lose. I really appreciate the help that has been given and I just need to ask you all to show me a bit more kindness so that I can get this thing working.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
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: 179
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Please help me fix these errors

 
0
  #12
Jan 4th, 2009
>I just need to ask you all to show me a bit more kindness so that I can get this thing working.

Kindness is not what you need nor will it get that thing working.
What you need is to understand how scanf() works.

scanf() always leave behind the ENTER key, when you press ENTER/RETURN. Which will be read by the next call.
If you insist in using it, then you need to accommodate that behavior.

A possible solution would be to declare another "waste key char" and using in conjunction with the first format , since you know you'll have to press enter to summit data.
char enter_key;
scanf("%d%c", &num, &enter_key);
Of course, that will not prevent the user from entering unexpected input and screwing it. That's for the best scenario.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 40
Reputation: RenFromPenn is an unknown quantity at this point 
Solved Threads: 0
RenFromPenn RenFromPenn is offline Offline
Light Poster

Re: Please help me fix these errors

 
0
  #13
Jan 4th, 2009
I don't insist upon using scanf. If you have a better suggest, then I am perfectly happy to hear it.

Trying you suggestion did cause each line to display. I was able to enter a number, a character, but not the floating point. When The line came up it already had a value there. The program also didn't assemlbe everything and print it as it's supposed to.

--

Okay, this time I tried it and the floating point line didn't have a value already. It, however, wouldn't let me type anything there.
Last edited by RenFromPenn; Jan 4th, 2009 at 5:15 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
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: 179
Aia's Avatar
Aia Aia is offline Offline
Postaholic
Reply

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




Views: 864 | Replies: 13
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC