Hi there guys I can't seem to get the logic on how to put the total price of tickets bought in a movie reservation program. For example, a ticket price is sold for $2 and a customer reserved more than one seat, the price should add all the tickets bought by the customer then display the total amount to be paid... My professor didn't show us how to do it, he just showed us how to do the seats. Here is my code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
char ans;\
int seatnumber;
string s1 = "free", s2 = "free", s3 ="free";
string reserved;
double ticketprice(3.5);
cout << "Reserve Seat no: ";
do
{
system ("cls");
cout << "|| seat 1 - " << s1 << " || seat 2 - " << s2 << " seat 3 - " << s3 << " || \n";
cin >> seatnumber;
cout << endl;
switch (seatnumber)
{
case 1:
if (seatnumber == 1)
{
if (s1 == "reserved")
cout << "Already reserved\n";
}
s1 ="reserved";
break;
case 2:
if (seatnumber == 1)
{
if (s2 == "reserved")
cout << "Already reserved\n";
}
s2 ="reserved";
break;
case 3:
if (seatnumber == 1)
{
if (s3 == "reserved")
cout << "Already reserved\n";
}
s3 ="reserved";
break;
default:
cout <<"Error!";
}
cout << "|| seat 1 - " << s1 << " || seat 2 - " << s2 << " seat 3 - " << s3 << " || \n";
cout << "Do you wish to reserve another seat?";
cin >> ans;
}
while (ans!='n'&&ans!='N');
}
Now all this program can do is to show whether a seat is reserved or not. Please help me...