我的教授说我的代码缺少这两个方面
但是我不确定它们的含义。
我已将int变量设置为默认值0,但我不知道如何为它们分配新值。
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main ()
{
string theatre = "AMC Universal CityWalk";
string present = "Presenting";
string movie = "A Star is Born Encore";
string show = "Show time";
string time = "PM";
string day = "Date";
string room = "Theatre";
string rating = "PG-13";
string admission = "Adult Admission";
string ad = "Don't forget to get your free small popcorn"
" with 4 tickets or more!!!";
/*
int timeHour = 3;
int timeMinute = 20;
int dateMonth = 04;
int dateDay = 12;
int dateYear = 2019;
int roomNumber = 10;
float price = 12.75;
*/
int timeHour = 0;
int timeMinute = 0;
int dateMonth = 0;
int dateDay = 0;
int dateYear = 0;
int roomNumber = 0;
float price = 0.0;
cout << "\t\t" << theatre << endl;
cout << "\t\t\t" << present << endl;
cout << "\t\t" << movie << endl;
cout << show << ": " << timeHour << ":" << timeMinute << " " << time;
cout << "\t" << day << ": " << dateMonth << "/" << dateDay << "/" <<
+ dateYear << endl;
cout << room << ": " << roomNumber;
cout << "\t\t\t" << rating << endl;
cout << admission << ": $" << price << endl;
cout << ad << endl;
}
我需要打印出注释部分中的值,但是我无法弄清楚如何为int变量分配新值。
答案 0 :(得分:0)
首先阅读此https://en.wikipedia.org/wiki/Assignment_(computer_science) 如果要为变量设置新值,请执行以下操作:
int timeHour = 0;
timeHour = 10;