Results 1 to 2 of 2

Thread: Some help in C

  1. #1
    Junior Member
    Join Date
    Sep 2001
    Posts
    3

    Question Some help in C

    Hey guys,

    I need some help writing code for a really simple inventory program. I need to code a program that has two sections. i already have the base program. I am using switch statements to choose between the two sections. Here is my problem: i need to set up a loop inside these switch statements. I am going to use 9999 as the sentinel to go between the sections, and i need to set EOF as the controlling sentinel to exit the program. I have tried to put two switch statements before each case in switch, and put a main while with the switch statement inside. But it does not work. If anybody knows what i am doing wrong please let me know.


    "Every great advance in science has issued from a new audacity of the imagination." -- John Dewey
    :

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Posts
    356
    ok, im not sure that i know exactly what you want, but ill give it a shot here:
    Code:
    while(sectionSelectVar != EOF)    //i dont really remember what how to represent an EOF
    {
         switch(sectionSelectionVar)
         {
              case 1:
                  while(sectionSelectionVar != 9999 && sectionSelectionVar != EOF)
                          sectionSelectionVar = section1();
                   if(sectionSelectionVar == 9999)
                          sectionSelectionVar = 2;
                   break;
    
              case 2:
                  while(sectionSelectionVar != 9999 && sectionSelectionVar != EOF)
                          sectionSelectionVar = section2();
                   if(sectionSelectionVar == 9999)
                          sectionSelectionVar = 2;
                   break;
         }//end switch
    }//end while
    -8-

    There are 10 types of people in this world: those who understand binary, and those who dont.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •