c++ 遇到的问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 04:09:48
// yy.cpp
#include <iostream>
using namespace std;
int main()
{
cout << " please input 3 numbers a,b and c:';
double a,b,c;
cin >> a >> b >> c;
double sum = a + b + c;
cout <<"a="<<a<<'\t' <<"b="<<b<<'\t'<<"c="<<c<<'\n';
cout <<"the sum of a,b and c is "<<sum<<endl;
return 0;

}

--------------------Configuration: yy - Win32 Debug--------------------
Compiling...
yy.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\yy\yy.cpp(6) : error C2001: newline in constant
D:\Program Files\Microsoft Visual Studio\MyProjects\yy\yy.cpp(7) : error C2144: syntax error : missing ';' before type 'double'
Error executing cl.exe.

yy.exe - 2 error(s),

cout << " please input 3 numbers a,b and c:';

后面是双引号
cout << " please input 3 numbers a,b and c:";

cout << " please input 3 numbers a,b and c:';
你最后两个标点是中文的

yy.exe - 2 error(s), 0 warning(s)

看了不知道如何改

还有错误每次提示(6) : error C2001之类的是什么意思

2error 表示有2个错误

还有错误每次提示(6) 6表示在第6行

error C2001之类的是什么意思 是错误类型

cout << " please input 3 numbers a,b and c:';
这句代码有错误,倒数第二个单引号应该是半角单引号

cout <<"a="<<a<<'\t' <<"b="<<b<<'\t'<<"c="<<c<<'\n';
两个\t和\n都应该用双引号括起来