这个问题我始终弄不明白
#include <iostream>using namespace std;
int a,b;
int main()
{
cin >>a,b;
if (a%2==0,b%2==0)(a%2==1,b%2==1),
cout <<"yes"<<endl;
else
cout<<"no"<<endl;
return 0;
}
我其实想要弄一个a,b是否同奇偶的,可就是不行,请求帮助!
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; if( (a%2==0 && b%2==0) || (a%2==1 && b%2==1) ) cout << "yes" << endl; else cout << "no" << endl; return 0; }
#include <iostream> using namespace std; int main( void ) { int a, b; cin >> a >> b; cout << (a%2==b%2?"yes":"no") << endl; }