jeudi 27 avril 2017

C++ How do i display the input like a receipt after the user has typed them

Hi im creating a cinema ticket operator as a self short project but i am a bit stuck on how to make the results of what the user inputs show up at the end summed up like on a receipt. Thanks in advance.

This is my code :

#include <iostream>
#include <string>
using namespace std;

int selectStaff();
int selectDate();
int selectMovie();
int printReceipt(int a);
string name, date;

int main()
{
int movie;

selectStaff();
date = selectDate();
movie = selectMovie();
printReceipt(movie);

return 0;
}
int printReceipt(int a) 
{
if (a == 1) {
cout << "Deadpool" << endl;
}
else {
cout << "Goosebumps" << endl;
}

return 0;
}

int selectStaff() {
cout << "Welcome to FILM Screen Cinema" << endl;
cout << endl;
cout << "ENTER STAFF/OPERATOR'S NAME: " << endl;
cin >> name;

return 0;
}

int selectDate() {
cout << endl;
cout << "ENTER DATE:";
cin >> date;

return 0;
}

int selectMovie() {
int movie;

cout << endl;
cout << "CHOOSE A MOVIE THAT IS SCREENING TODAY:" << endl;
cout << endl;
cout << "Press 1 for first option & 2 for second option" << endl;
cout << endl;
cout << "[1] Deadpool" << endl << "[2] Goosebumps" << endl;
cin >> movie;

return 0;
}

I want all the required input to be displayed at the bottom so when it prints, the user can view the summary. I also need a closing message that says "thank you"

Aucun commentaire:

Enregistrer un commentaire