我的控制台给我一个错误?

时间:2016-02-12 22:39:36

标签: c++

你好,我想知道你是否可以帮我解决我的代码g ++控制台说“28 37 C:\ Users \ paul \ Documents \ C ++ \ main.cpp [Error] expected';'在'电影'之前“

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


int main()

{

int tomscore;
string movie;
int metascore;


cout << "Hello there what movie are you wondering about?" << endl;
cin >> movie;

cout << "What is the Rotten Tomato score of the movie in decimal form?"<< endl;
cin >> tomscore;

cout << "What is the metascore?" << endl;
cin >> metascore;

int average = tomscore+metascore;

int averageGOD = average/2;

cout << "The average score for" " " movie " " "was" averageGOD << endl;   
 }

1 个答案:

答案 0 :(得分:6)

这是一个错误:

cout << "The average score for" " " movie " " "was" averageGOD << endl;

您需要在要发送到流的每个项目之间使用<<。将空格放在自己的文字中也是多余的:

cout << "The average score for " << movie << " was " << averageGOD << endl;

如果您尝试输出引号,请在字符串中使用\"

相关问题