WHILE LOOP in 'C'
ok here is my problem im trying to get this program to loop and loop and cant get it to. ok here is the code and im about to go crazy crazy crazy i dont know what im doing wrong. can anyone help me.
Code:
#include <stdio.h> Code:
>><<>><< 1 /-|/| 7#3 1337357 /-|>,()(_)|||) <<>><<>><<> |
scanf() is leaving a \n on the buffer. Try changing...
Code:
scanf("%c", &cCode); Code:
scanf("%c", &cCode); |
YOU ARE FOOKING AWSOME !!!! thnx....... it works awsomely... now i just dont know how to clear the screen after it loops ... thanx :P :P :P im so excited..
|
oh yea one more question sorry for the hassle and bother....
ok now im using the switch statement and i get this warning Code:
|
printf("\033[H\033[J"); is clearing the screen with most terminal emulators, if you want a 100% portable solution look at curses.
the loop (and the program) should already stops with your test: if (cCode == 'C' || cCode == 'c') the construction: if (cCode != 'a','b','c','d') is certainly not doing what you expect (this test is always true). Your program would greatly improve should you use the switch/case syntax vs all these ifs, and with a better care of the spelling, specially for the dialog with the user :study: |
All times are GMT -5. The time now is 09:15 AM. |