Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 3 part 2 Book v0.5
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//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=5; int 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\n3.Report Avaliable Slots\n 4.Quit Program\n"); do{ scanf("%d",&x); switch(x){ case 1: if(Satslot<=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); case 2: if(Sunslot<=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); case 3: printf("There are %d slots open on Saturday",Satslots); printf("There are %d slots open on Sunday",Sunslots); case 4: printf("Thanks for stopping by"); break; } }while(x!=4) return 0; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
fork mode
|
history
|
discussion