Help! for movie tickets [I'm seriously dying]
so I'm just a beginner and my teacher gave me complicated final project. I really need help as I have to submit it next week. please help.
1. display greeting (i've done it)
2. display seats (already)
3. price of tickets (already)
4. ask user seats (I'm stuck from here)
5. tell if available or unavailable. if yes, tell ticket price. if not, display seats ask to find other seat.
6. if decided to buy, ask for name and display payment receipt.
7. calculate n display in file tickets sold by rows in number and RM and then display total sales.
8. seats should be updated.
9. display bar chart of ticket sold vs no of rows.
it's toooo long that I really need help. btw, I'm malaysian and dikir barat is a show name and RM is our currency.
here's my coding, I've already try other's program but it couldn't work
#include <iostream>
#include <iomanip>
#include <istream>
using namespace std;
void place(char seats[15][30]);
int main ()
{
char seats[15][30]={{'*','*','*','*','*','#','#','*','*','*','*','*','*','*','#','*','*','*','*','*','#','#','#','#','#','#','*','*','*','#'},{'*','*','#','#','*','*','*','#','#','#','*','*','#','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'#','#','*','#','*','#','#','*','*','#','#','*','*','*','#','#','*','*','*','*','#','#','#','#','#','#','#','#','*','#'},{'*','*','#','*','*','#','#','*','*','#','*','*','*','*','#','*','#','*','*','*','#','#','#','#','#','#','*','*','#','#'},{'#','#','#','#','*','*','*','#','#','#','*','*','#','*','#','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'#','*','*','*','*','#','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','#','*','#','*','#','#','*','*','*','*'},{'*','*','*','*','*','*','*','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#'},{'*','*','*','#','*','*','*','#','*','#','*','*','#','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','#','*','*','*','*','#','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','#','#','#','*','*','*','*','*','#'},{'*','*','*','*','*','#','#','*','*','*','*','*','*','*','*','*','*','*','*','*','#','#','*','*','*','*','*','*','*','#'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','#','#','#','*','*','*','*'},{'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','*','#'}};
cout<<" The Dikir Barat Show"<<endl;
cout<<setw(40)<<"Welcome"<<endl;
place(seats);
cout<<endl<<"* : AVAILABLE\n"<<"# : BOOKED";
cout<<endl<<endl<<endl;
cout<<" TICKET PRICING"<<endl;
cout<<"________________________________________________________________________"<<endl;
cout<<"| Row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |"<<endl;
cout<<"_______|_______|_______|_______|_______|_______|_______|_______|_______|"<<endl;
cout<<"| RM | 10 | 10 | 10 | 12 | 14 | 16 | 18 | 20 |"<<endl;
cout<<"_______________|_______|_______|_______|_______|_______|_______|_______|"<<endl;
cout<<"________________________________________________________________"<<endl;
cout<<"| Row | 9 | 10 | 11 | 12 | 13 | 14 | 15 |"<<endl;
cout<<"_______|_______|_______|_______|_______|_______|_______|_______|"<<endl;
cout<<"| RM | 25 | 30 | 25 | 20 | 18 | 14 | 10 |"<<endl;
cout<<"_______|_______|_______|_______|_______|_______|_______|_______|"<<endl<<endl;
return 0;
}
void place(char seat[15][30])
{
cout<<endl<<setw(40)<<"Seats"<<endl;
cout<<" | a | b | c |"<<endl;
cout<<" ";
for (int i=1;i<10;i++)
{
cout<<i<<" ";
continue;
}
for (int i=10;i<20;i++)
{
cout<<i-10<<" ";
continue;
}
for (int i=20;i<30;i++)
{
cout<<i-20<<" ";
continue;
}
int i;
if (i=30)
{
cout<<i-30<<" ";
}
cout<<endl;
for (int i=0;i<9;i++)
{
cout<<"ROW "<<i+1<<" ";
for (int j=0;j<30;j++)
{
cout<<seat[i][j]<<" ";
}
cout<<endl;
continue;
}
for (int i=9;i<15;i++)
{
cout<<"ROW "<<i+1<<" ";
for (int j=0;j<30;j++)
{
cout<<seat[i][j]<<" ";
}
cout<<endl;
continue;
}
}
Re: Help! for movie tickets [I'm seriously dying]
First, please, use CODE tags while posting code snippets. See Announcement: Before you post....
Second, what exactly "couldn't work"?
Re: Help! for movie tickets [I'm seriously dying]
i tried to use code from other peoples, but it's not fitting to requirements that my teacher needs.
i'm sorry for not using code tags
Re: Help! for movie tickets [I'm seriously dying]
Quote:
i tried to use code from other peoples,
That is considered cheating and is not condoned. See http://forums.codeguru.com/showthrea...ork-assignment
Your first issue is here. You define i as a type int but don't initialise it so its initial value is undefined - and then you set i to 30 (do you mean equality which is == ?) and then you test that the result of assigning 30 to i as a condition is true. The result of assigning 30 to i will always be 30 so the condition is always true.