Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- int main(void)
- {
- int passengerSeat=8, windowsSeat=4;
- char choice;
- do{
- printf("\nDo you want to be at the window seat?");
- fflush(stdin);
- scanf("%c", &choice);
- switch(choice){
- case 'Y' :
- if(windowsSeat>0){
- windowsSeat--;
- passengerSeat--;
- printf("%d %d",windowsSeat, passengerSeat);
- }else{
- printf("No more window seat available.");
- }break;
- case 'N' :
- passengerSeat--;
- printf("%d", passengerSeat);
- break;
- }
- }while(passengerSeat>0);
- printf("No more seats available");
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement