Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 3 part 2 Book v1
//gcc 5.4.0 #include <stdio.h> // //Start Program: //int x; //int Satslots=5; //int Sunslots=5; //PRINT "Welcome to Sunshine Bus Tours \n To Book a tour reservation or Report the avaliable tour slots follow the instructions in the menu below.\n Select Options by typing in the number adjacent to your preferred selection \n \n SELECT DAY:\n\n1.Book for Saturday\n 2. Book for Sunday\n3.Report Avaliable Slots\n 4.Quit Program\n" //do{ //READ x // switch(x){ // case 1: // if(Satslot<=0) // PRINT "There are no slots avaliable on Saturday."; // else // --Satslots; // PRINT "You have registered for a tour on Saturday. There are %d slots remaining.",Satslots // case 2: // if(Sunslot<=0) // PRINT "There are no slots avaliable on Sunday."; // else // --Sunslots; // PRINT "You have registered for a tour on Sunday. There are %d slots remaining.",Sunslots // case 3: // PRINT "There are %d slots open on Saturday",Satslots // PRINT "There are %d slots open on Sunday",Sunslots // case 4: // PRINT "Thanks for stopping by" // return 0; // } // }while(x!=4) //End Program: int main(void){ int x; int Satslots; Satslots=maxslots; int Sunslots; Sunslots=maxslots; int maxslots=5; printf("Welcome to Sunshine Bus Tours \n To Book a tour reservation input 1, and select your day:\n 1.Saturday\n 2.Sunday\n To Cancel a reservation input 2 then select your day:\n 1.Saturday\n 2.Sunday\n To Switch a reservation input 3 then select your day:\n 1.Saturday\n 2.Sunday\n To Report the avaliable tour slots input 3\n Select Options by typing in the number adjacent to your preferred selection \n Please all querys with a 4 to terminate the program\n"); scanf("%d",&x); switch(x){ case 1: do{ scanf("%d",&x); switch(x){ case 1: if(Satslots<=0){ printf("There are no slots avaliable on Saturday.\n"); continue; } else --Satslots; printf("You have registered for a tour on Saturday. There are %d slots remaining.\n",Satslots); // break; // return 0; continue; case 2: if(Sunslots<=0) printf("There are no slots avaliable on Sunday.\n"); else{ --Sunslots; printf("You have registered for a tour on Sunday. There are %d slots remaining.\n",Sunslots); // break; // return 0; continue; } case 3: printf("There are %d slots open on Saturday\n",Satslots); printf("There are %d slots open on Sunday\n",Sunslots); // break; // return 0; continue; case 4: printf("Thanks for stopping by!"); // break; // return 0; continue; } }while(x!=4); case 2: do{ scanf("%d",&x); switch(x){ case 1: if(Satslots>=maxslots){ printf("There were no reserverions made for Saturday.\n"); continue; } else ++Satslots; printf("You have registered for a tour on Saturday. There are %d slots remaining.\n",Satslots); // break; // return 0; continue; case 2: if(Sunslots>=maxslots) printf("There were no reservations made for Sunday.\n"); else{ ++Sunslots; printf("You have registered for a tour on Sunday. There are %d slots remaining.\n",Sunslots); // break; // return 0; continue; } case 3: printf("There are %d slots open on Saturday\n",Satslots); printf("There are %d slots open on Sunday\n",Sunslots); // break; // return 0; continue; case 4: printf("Thanks for stopping by!"); // break; // return 0; continue; } }while(x!=4); case 3: do{ scanf("%d",&x); switch(x){ case 1: if(Satslots>=maxslots){ printf("There are no slots avaliable on Saturday.\n"); continue; } else ++Satslots; --Sunslots; printf("You have registered for a tour on Saturday. There are %d slots remaining.\n",Satslots); // break; // return 0; continue; case 2: if(Sunslots>=maxslots) printf("There are no slots avaliable on Sunday.\n"); else{ ++Sunslots; --Satslots; printf("You have registered for a tour on Sunday. There are %d slots remaining.\n",Sunslots); // break; // return 0; continue; } case 3: printf("There are %d slots open on Saturday\n",Satslots); printf("There are %d slots open on Sunday\n",Sunslots); // break; // return 0; continue; case 4: printf("Thanks for stopping by!"); // break; // return 0; continue; } }while(x!=4); return 0; } }
run
|
edit
|
history
|
help
0
Sumit
Ordered Openmp
C_141204_ContadorPalabras
Spring 2017 Project 2 v1.3
CreverseInt
Factorial Descompuesto en Potencias de Numeros Primos
Undefined argument processing order in C
Linked List demo in C
Taco practice
C_141127_Matriz01