C++ C++;在用户键入输入内容后,如何将其显示为收据

C++ C++;在用户键入输入内容后,如何将其显示为收据,c++,C++,嗨,我创建了一个电影票运营商作为一个自我短期项目,但我有点被困在如何让用户输入的结果显示在最后,总结起来就像在收据上一样。提前谢谢 这是我的代码: #include <iostream> #include <string> using namespace std; int selectStaff(); int selectDate(); int selectMovie(); int printReceipt(int a); string name, date; int

嗨,我创建了一个电影票运营商作为一个自我短期项目,但我有点被困在如何让用户输入的结果显示在最后,总结起来就像在收据上一样。提前谢谢

这是我的代码:

#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;
}
#包括
#包括
使用名称空间std;
int selectStaff();
int selectDate();
int selectMovie();
int打印收据(INTA);
字符串名称、日期;
int main()
{
国际电影;
选择staff();
日期=选择日期();
movie=选择movie();
印刷收据(电影);
返回0;
}
int打印收据(int a)
{
如果(a==1){

cout您将所有变量排列在一起,以便简洁明了地执行此操作。只需编辑打印收据函数,使其看起来像:

Int printreceipt(int a) { 
string title; 
if (a==1) { 
title = "Deadpool"; 
} else { 
title == "Goosebumps"; 
} 
cout << "Cashier: "; cout << name << endl << endl; //say the operator's name and add a line
cout << "Date: " << date << endl; //say the date
 cout << "Movie: " << title; //say the title of the movie
 cout << endl << endl; //add a line
 cout << "Thank you for choosing this cinema! Enjoy!"; //Thank you message :D
}

我们不是你的家庭作业猴子。我说的自选短小项目这意味着什么家庭作业?你尝试了什么?如果你想学习这门语言,你应该能够很容易地找到如何做到这一点的信息。你之前也在同一代码上发布了另一个问题。如果你真的只是想学习,我建议你在att之前多学习一些清空一个自助项目。可能是因为他认为它代表命令行界面。
Cashier: Guy

Date: May 5, 2017
Movie: Deadpool
Thank you for choosing this cinema! Enjoy!