Advertisement
Guest User

passengerSeat mario

a guest
Aug 29th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main(void)
  4. {
  5. int passengerSeat=8, windowsSeat=4;
  6. char choice;
  7. do{
  8. printf("\nDo you want to be at the window seat?");
  9. fflush(stdin);
  10. scanf("%c", &choice);
  11. switch(choice){
  12. case 'Y' :
  13. if(windowsSeat>0){
  14. windowsSeat--;
  15. passengerSeat--;
  16. printf("%d %d",windowsSeat, passengerSeat);
  17.  
  18. }else{
  19. printf("No more window seat available.");
  20. }break;
  21. case 'N' :
  22. passengerSeat--;
  23. printf("%d", passengerSeat);
  24. break;
  25. }
  26.  
  27. }while(passengerSeat>0);
  28. printf("No more seats available");
  29. getch();
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement