Home Forums C Programming please help me

Viewing 1 reply thread
  • Author
    Posts
    • #2155
      TobiasForan
      Participant

      can anyone to help me about this turbo c prog problem??

      here is the output..

      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 2
      Enter Result (1=pass, 2fail): 2
      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 2
      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 1
      Enter Result (1=pass, 2fail): 2

      Passed: 6
      Failed: 4

      ======
      tnx please help me guys…thank you

    • #3476
      GWILouisaxwzkla
      Participant

      Could do:


      /****************************************************************
      * File Name : c:programshelptempCG.cpp
      * Date : November,17,2008
      * Comments : new project
      * Compiler/Assembler :
      *
      *
      *
      *
      *
      * Program Shell Generated At: 3:18:48 p.m.
      =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


      #include
      //#include
      //#include
      //#include
      //#include
      //#include



      //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 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 ;
      }

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.