【发布时间】:2014-01-24 18:31:26
【问题描述】:
第一次上计算机科学课。第一个实验室任务。写的和老师写的一模一样,但是编译不出来,老师和我都不知道为什么。请帮忙。谢谢。
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int number;
string residence;
//Just an example of a comment
cout << "Hello. Welcome to CSCI-1!" endl;
cout << "Spring 2014" endl;
cout << "please enter a number: " endl;
cin >> number;
cout << "you entered the number: " << number <<endl;
cout<<"Please enter your state of residence: " endl;
cin>>residence;
cout <<"you stated you live in " << residence <<"." <<;
return 0;
}
错误:
lab01.cpp:在函数“int main()”中:
lab01.cpp:11: 错误:在“endl”之前需要“;”
lab01.cpp:12: 错误:在“endl”之前需要“;”
lab01.cpp:14: 错误:在“endl”之前需要“;”
lab01.cpp:19: 错误:在“endl”之前需要“;”
lab01.cpp:21: 错误:';' 标记之前的预期主表达式
【问题讨论】:
-
“endl”前缺少“
-
如果你的老师看不出这里有什么问题,我真的很担心。
-
是的,我们的老师是位数学老师,我想这是他第一次教 csci。
-
你应该向你的大学投诉,因为你指派了一名数学老师来教授他一无所知的科目——几乎任何已经超越初学者状态的人都能立即解释这些错误。
标签: c++ cloud9-ide