每次我尝试编译它时都会得到一条错误信息
“exercise3.cpp:10:49:错误:预期';'在'endl'之前”
如果我在;
之前添加endl
,我会收到错误消息
“exercise3.cpp:8:71:error:语句无法解析重载函数的地址”
我不知道这个问题是什么,所以任何帮助都会受到赞赏。
代码:(抱歉没有排好,但我向你保证它是。)
#include "iostream"
using namespace std;
int main()
{
cout << "hello there!\n";
cout << "here is 5: "<< 5 << "\n";
cout << "the manipulator end1 wrotes a new line to the screen."; endl;
cout << "here is a very bug number:\t" << 70000 endl;
cout << "here is the sum of 8 and 5:\t" << 8+5 endl;
cout << "heres a fraction:\t\t" << (float) 5/8 endl;
cout << "and a very big number:\t" << (double) 70000*70000 endl;
cout << "you really dont have to type this line XD\n";
cout << "or this one :P cause its not really needed!\n";
return 0;
}
答案 0 :(得分:2)
您需要在<<
之前插入endl
。
答案 1 :(得分:2)
cout << "the manipulator end1 wrotes a new line to the screen."; endl;
应该是
cout << "the manipulator end1 wrotes a new line to the screen." << endl;
等等
答案 2 :(得分:1)
你需要&lt;&lt;在每个endl之前。