关于cout的小问题
#include <iostream>using namespace std;
int main()
{
int x;
cin>>x;
cout<<'x='<<x<<endl;
return 0;
}
为什么会有warming multi character characterconstant
而且数值不对 字符串要用双引号
#include <iostream>
using namespace std;
int main()
{
int x;
cin>>x;
cout<<"x="<<x<<endl;
return 0;
}
8
x=8 'x' 字符
"x=" 字符串 除了 python ,其它的编程语言字符串都需要用双引号
#include <iostream>
using namespace std;
int main()
{
int x;
cin>>x;
cout<<"x="<<x<<endl; // 把 'x=' 改成 "x="
return 0;
}
大马强 发表于 2022-2-23 16:19
字符串要用双引号
谢谢你 isdkz 发表于 2022-2-23 19:36
除了 python ,其它的编程语言字符串都需要用双引号
谢谢!
页:
[1]