Home › Forums › C Programming › please help me about turbo c prog problem? › Re: Re: please help me
November 17, 2008 at 8:41 pm
#3476
GWILouisaxwzkla
Participant
Could do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <br /> /**************************************************************** * File Name : c:programshelptempCG.cpp * Date : November,17,2008 * Comments : new project * Compiler/Assembler : * * * * * * Program Shell Generated At: 3:18:48 p.m. =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ #include <stdio.h> //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@ //################################################################################## //main function ****************************** int main ( ) { int result; int fail = 0 , pass = 0; char newline; printf ( "Enter Result (1=pass, 2fail , 3=quit: )"); scanf ( "%i", & result ); scanf ( "%c", & newline); //get newline out of stream ( enter key ) while ( result != 3 ) { if ( result == 1 ) pass ++; else if ( result == 2 ) fail ++; printf ( "Enter Result (1=pass, 2fail , 3=quit: "); scanf ( "%i", & result ); scanf("%c", &newline); //get newline out of stream ( enter key ) } printf ( "pass = %i n" , pass ); printf ( "pass = %i n" , fail ); return 0 ; } |