Posted by: Dananah October 18, 2004
C Program help
Login in to Rate this Post:     0       ?        
robert dude!!mero pani tauko dhukio reading what u posted!!!!!!!ARGHHHHHHHHHHHHHH!!! plus im already getting a headache doin some programming assignments due tomorrow :oS...pretty huge :oS...dyam why does other ppl assignments seems more fun to do and easier..;oP... anyways dun really understand C but looking at ur code ..it does say ur program willl guess a number between 0-100..am i wrong?..or is it 10?so any numbers btween 0-10? printf( "I will guess your secret number if the number is between 0 and 100ý); is there a typo here with the 100? cos if its between 0-10...pretty easy ;oP for (Guess = NUM; (Guess >0) &&(answer != 'y'); --Guess) since NUM was instantiated as 10.. this code does say the program starts guessing from 10..and goes down everytime the guess is wrong until u reach 1....if the user says the program didnt guess it right even when the gues was 1..well..the user cheated... i think ur supposed to change the code and use while-loop instead of for-loop arent u?klanki bro help him...i think u know C hehe... anyways heres roughly what i would do.. void main() { int Guess=10 ; //let guess start from 10 char answer; printf( "I will guess your secret number if the number is between 0 and 10); while (Guess > 0) //1st loop Guess equals 10 { printf( "Is Your guess %d \n", Guess); scanf( %c, &answer); //dunno if these 2 lines shud be placed here if (answer != 'y'') guess--; //1st loop number now goes down to 9&goes thru the loop again else if (answer =='y') printf( "Wow my guess is right \n"); } printf( "you Cheatedý); //since u came out of the while loop witout getn a 'y' //user cheated by not choosin a number btween 1-10 } hope that gave u and idea..hope its right hehe... dyam i gotta go back to me own work...ARGHHHH!!! anyone free to help in VB.NET?notes are shit!!!not helping..:oS... im gone!!!woohoooo!!! mero pani tauko esto ghumayko cha!!!hyaaaaaa!! danny
Read Full Discussion Thread for this article