try this code:
Code:
#include <iostream.h>
#include <string.h>
#include <winbgim.h>
void Seat ();
void Name ();
// declare variables
int hold;
int passenger;
char nam[50];
int smoke;
int main()
{
// get input
for (passenger = 0; passenger <=20; passenger++)
{
Name();
cout << "Smoking on plane 1)Yes or 2) No\n";
cin >> smoke;
Seat();
}
while(!kbhit());
return 0;
}
void Seat(){
switch (smoke)
{
case 1:
cout << "Please sit in back of the plane on seats 15-20 \n";
while(!kbhit());
break;
case 2:
cout << "Please sit on seats 1-14 and please don't smoke.\n";
while(!kbhit());
break;
default:
cout << "Seats are filled. Sorry.\n";
while(!kbhit());
break;
}
smoke =0;
}
void Name()
{
cout << "Plz, enter your name and remember to put a * at the end of your name :\n ";
cin.getline(nam,50,'*'); //arry(nam),length(50),exit character(enter)
}
ill attach the winbgim.h file for u