#include <iostream>
usingnamespace std;
int main()
{
char code, hall, f;
int aud;
float price, g1(char hall, int aud), g2(char hall, int aud);
cout<<"Film Code T : Ong Bank III (Thai)"<<endl;
cout<<"Film Code U : Twilight Saga : Eclipse (USA)"<<endl<<endl;
cout<<"Enter Film Code : ";
cin>>code;
if (code == 'T')
{
cout<<"\n\nType of Hall : G for Cempaka Gold RM40 \nType of Hall : P for Kenanga Premier RM20"<<endl<<endl;
cout<<"Enter Hall Type : ";
cin>>hall;
cout<<"Enter Audiences Number : ";
cin>>aud;
price=g1(hall, aud);
}
if (code == 'U')
{
cout<<"\n\nType of Hall : G for Anggerik Gold RM40 \nType of Hall : P for Melor Premier RM20"<<endl<<endl;
cout<<"Enter Hall Type : ";
cin>>hall;
cout<<"Enter Audiences Number : ";
cin>>aud;
price=g2(hall, aud);
}
cout<<"\n\nSTAR ENTERTAINMENT REPORT"<<endl;
cout<<"##########################"<<endl<<endl;
cout<<"Film Code : "<<code<<endl;
cout<<"Film Title : "<<endl;
cout<<"Type of Hall : "<<hall<<endl;
cout<<"Number of Tickets : "<<aud<<endl;
cout<<"Total Price (RM) : "<<price<<endl<<endl;
cout<<"Thank you. Please come again."<<endl<<endl;
system("PAUSE");
return 0;
}
float g1(char a, int c)
{
float ticket;
if (a=='G')
{
ticket=c*40.00;
}
elseif (a=='P')
{
ticket=c*20;
}
else
{
cout<<"Wrong input. Try again."<<endl;
}
return ticket;
}
float g2(char b, int d)
{
float ticket;
if (b=='G')
{
ticket=d*40;
}
elseif (b=='P')
{
ticket=d*20;
}
else
{
cout<<"Wrong input. Try again."<<endl;
}
return ticket;
}
my question is, how to call "Film Tittle"..?
i have no idea..:(
std::string Movies[] = {
"Movie 01 Title",
"Movie 02 Title",
/* ... */
"Movie ?? Title"
};
constunsignedint MovieCount = sizeof(Movies) / sizeof(*Movies);
// This will hold how many movies you have stored
float MoviePrices[MovieCount] = {
// If you get an error here it's probably because some movies don't have their price in this list
// So look out and add or remove the missing/extra prices
50.00f, // Suppose first movie is 50$
25.00f, // And the second is 25$
/* etc etc */
150.00f
};
// To print first film's name:
cout << Movies[0];
// To print last film's name:
cout << Movies[MovieCount-1];
// To print all film's names:
for(unsignedint i = 0; i < MovieCount; ++i)
cout << Movies[i] << endl;
// To get first movie's price:
cout << MoviePrices[0];
// To print both all film's names and prices:
for(unsignedint i = 0; i < MovieCount; ++i)
cout << Movies[i] << " " << MoviePrices[i] << endl;