i need help whit my code
i am confused, i would appreciate any help and thanks in advanced.
the code is suppose register the number of 20 seat and the name of the person
in this program if you press 1 it should reserve the seat
if you press 2 it should not reserve the seat
you press 3 it should report if you reserved or not
if you press 4 it should exit the program
this part of the code is suppose to gather information if the seat is reserved or not reserved. i need to add this part to my main code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
int main()
{
double slot[2][20];
for(int i = 0; i < 20; i++)
{
cout << "the seat number" << (i + 1) << "?";
cin >> slot[0][i];
cout << "what is the name?";
cin >> slot[1][i];
}
for(int i = 1; i < 20; i++)
{
double inf = seatReservation(slot[0][i-1], slot[0][i]);
cout << "the staus of the table" << slot[1][i-1] << " is " << inf << endl;
}
system("PAUSE");
return 0;
}
double seatReservation()
{
// print if reserved or not
}
|
this is my main code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include <iostream>
#include <string>
using namespace std;
int main ()
{
bool reservationStatus[20];
string names[20];
int seatNumber = 1;
int menuChoice;
while (true)
{
cout << "Please enter a selection" << endl;
cout << "Press 1 Reserve a seat" << endl;
cout << "Press 1 Clear Reservation" << endl;
cout << "Press 1 Order a Report" << endl;
cout << "Press 1 Exit Program" << endl;
cin >> menuChoice;
switch (menuChoice)
{
case 1:
for(int i=0; i < 20; i++)
{
reservationStatus[i] = false;
}
if (reservationStatus[seatNumber] == true)
{
cout << "not reserved" << endl;
cin >> reservationStatus[seatNumber];
}
break;
case 2:
if (reservationStatus[seatNumber] == false)
{
cout << "reserved" << endl;
cin >> reservationStatus[seatNumber];
}
break;
case 3:
// Code for the Report
break;
case 4:
return 0;
}
}
system ("PAUSE");
return 0;
}
|
Last edited on
Topic archived. No new replies allowed.