Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Project 3 part 2 Book v0.7
//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=5; int Sunslots; Sunslots=5; printf("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\nBook for a tour on:\n 1.Saturday\n 2.Sunday\n\n 3.Report Avaliable Slots\n 4.Quit Program\n"); do{ scanf("%d",&x); switch(x){ case 1: if(Satslots<=0) printf("There are no slots avaliable on Saturday."); else --Satslots; printf("You have registered for a tour on Saturday. There are %d slots remaining.",Satslots); // break; return 0; case 2: if(Sunslots<=0) printf("There are no slots avaliable on Sunday."); else --Sunslots; printf("You have registered for a tour on Sunday. There are %d slots remaining.",Sunslots); // break; return 0; case 3: printf("Saturday: %d/%d\n",Satslots,maxslots); printf("Sunday: %d/%d\n",Sunslots,maxslots); // break; return 0; case 4: printf("Thanks for stopping by"); // break; return 0; } }while(x!=4); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Command Expressions in Gnu C: What's the value of a loop? void!
T3.C
linux (mostly) true random number generator
Función quicksort decreciente
co_assign1_ques_4
141128_EjemploChorraArray
Check EOF Value
Instruction order in C/C++
SOLUCION EJERCICIO SPOTIFY
Revprint
Please log in to post a comment.