So basically i need to keep a running total of the amount of tickets, single and return ticket, amount of stops and the total price.
Any help would be greatly appreciated.
::::::::: This is where you enter the amount of tickets and the other things.
cout<<"\nPlease enter the number of adults ('0' if none):> ";
cin>>adult;
cout<<"\nPlease enter the number of children ('0' if none):> ";
cin>>children;
cout<<"\nPlease enter the number of seniors ('0' if none):> ";
cin>>senior;
cout<<"\nPlease enter the number of families ('0' if none):> ";
cin>>family;
cout<<"\nEnter 1 if return ticket ('0' if not) :> ";
cin>>Return;
cout<<"\nEnter 1 if single ticket ('0' if not) :> ";
cin>>Single;
cout<<"\nPlease enter the amount of stops: ";
cin>>stop;
}
float calcPrice(int adults, int children, int seniors, int families,
int Single,int Return, int stop)
{
float totalCost;
::::::::::::::::::: I need the running total of them to be kept here:::::::::::
"\nAmount of adult tickets: " << endl;
cin>>adulttotal;
cout << "\nAmount of children tickets: " << endl;
cin>>childrentotal;
cout << "\nAmount of senior tickets: " << endl;
cin>>seniortotal;
cout << "\nAmount of family tickets: " << endl;
cin>>familytotal;
cout << "\nAmount of single tickets: " << endl;
cin>>singletotal;
cout << "\nAmount of return tickets: " << endl;
cin>>returntotal;
cout << "\nTotal: " << endl;
cin>>pricetotal;
break;
switch (choice)
{
case 1:
do
{
cout << "Enter the Username: ";
cin >> username;
cout << "Enter the Password: ";
cin >> password;
}
while(password !="123Odus");
cout<<"Username and Password are correct"<<endl;
cout<< " " << endl;
break;
case 2:
system("start winword E:\Help.docx");
break;
case 3:
if (password != "123Odus")
{
cout<<"Please enter log-in details"<<endl;
}
else
{
cout << "Odus Ticketing now online" << endl;
getQuantity(adults,children,seniors,families,Single,Return,stop);
totalCost=calcPrice(adults,children,seniors,families,Single,Return
,stop);
cout<<"Total cost: "<<totalCost<<endl;
}
break;
case 4:
cout << "Odus Report" << endl;
cout<< " " << endl;
cout << "\nAmount of adult tickets: " << endl;
cin>>adulttotal;
cout << "\nAmount of children tickets: " << endl;
cin>>childrentotal;
cout << "\nAmount of senior tickets: " << endl;
cin>>seniortotal;
cout << "\nAmount of family tickets: " << endl;
cin>>familytotal;
cout << "\nAmount of single tickets: " << endl;
cin>>singletotal;
cout << "\nAmount of return tickets: " << endl;
cin>>returntotal;
cout << "\nTotal: " << endl;
cin>>pricetotal;
break;
case 5:
cout << "Odus closed" << endl;
}
}while (choice != 5);
}
void getQuantity(int &adult, int &children, int &senior, int &family,
int &Single, int &Return, int &stop)
{
cout<<"\nPlease enter the number of adults ('0' if none):> ";
cin>>adult;
cout<<"\nPlease enter the number of children ('0' if none):> ";
cin>>children;
cout<<"\nPlease enter the number of seniors ('0' if none):> ";
cin>>senior;
cout<<"\nPlease enter the number of families ('0' if none):> ";
cin>>family;
cout<<"\nEnter 1 if return ticket ('0' if not) :> ";
cin>>Return;
cout<<"\nEnter 1 if single ticket ('0' if not) :> ";
cin>>Single;
cout<<"\nPlease enter the amount of stops: ";
cin>>stop;
}
float calcPrice(int adults, int children, int seniors, int families,
int Single,int Return, int stop)
{
float totalCost;