以下代码生成"作为赋值左操作数所需的左值"
if( c >= 'A' && c <= 'Z' || c = " " || c = ",") {
Run Code Online (Sandbox Code Playgroud)
我假设我写错了,出了什么问题?我怎么写得正确?
我是StackExchange的新手,但我有一个简单的类,当我运行它时似乎没有返回正确的结果.这是代码:
#include <iostream>
using namespace std;
int thisIsHowYouIfLikeABoss2(int, int);
int main()
{
cout << "One." << endl;
thisIsHowYouIfLikeABoss2(9, 9);
cout << "Two." << endl;
thisIsHowYouIfLikeABoss2(4, 9);
return 0;
}
int thisIsHowYouIfLikeABoss2 (int x, int y)
{
cout << "Welcome to the thisIsHowYouIfLikeABoss(), where I calculate if x = y easily." << endl;
if (x = y)
{
cout << "X is Y." << endl;
}
if (x != y)
{
cout << "X is not Y" << endl;
}
} …Run Code Online (Sandbox Code Playgroud)