Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 3 part 2 Book v10.1
//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 maxslots=5; int Satslots; Satslots=maxslots; int Sunslots; Sunslots=maxslots; 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 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\n\n"); 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; } }while(x!=4); }
run
|
edit
|
history
|
help
0
Cbinsearch
C_141113_VariosPerfectos
First program.c
18BCE2182 ASSESS_1 Q2-2
SIGABRT error
Lab 10 v1
second P
formatting_input_and_output
Multiple If statements v.09
json formatter