Posted by: Robert Frost October 17, 2004
Login in to Rate this Post:
0
?
![](/wysiwyg/editor/images/smiley/msn/thumbs_up.gif)
![10 more flags than likes deactivates post.](/wysiwyg/editor/images/smiley/msn/thumbs_down.gif)
Could you post that one. Sounds like the similar process.
I got a problem, here is the code for a program that the assignment is based upon:
#include
void main()
{
const int NUM = 10;
int Guess ;
char answer;
for (Guess = NUM; (Guess >0) &&(answer != 'y'); --Guess)
{
printf( "I will guess your secret number if the number is between 0 and 100ý);
printf( "Is Your guess %d \n", Guess);
scanf(ý %cý, &answer);
}
if (answer =='y')
printf( "Wow my guess is right \n");
else
printf( "you Cheatedý);
}
Now I gotta do the same thing but here are some other criterias:
1) Extend this program with a while loop
2) Guess the number as long as the guess is incorrect.
I presume when you put the if statement code inside a while loop, it automatically goes back into putting a new value into it and asking the user if this is what he had guessed, if not, go back again and try it till he says yes.
Something like it. I have been trying hard, but since I donot have a clear cut basics on C-Programming, I am finding this simple program mighty headache.
Can somebody help please....