0
Please what is wrong with this code
#include <iostream> using namespace std; int main() { int n,w,x,y,z,a; n = w,x,y,z; cin >> w,x,y,z; a = z,y,x,w; if (n!=a){ cout<< w << " is NOT a palindrome" <<endl; } if (n==a){ cout<< w << " is a palindrome" <<endl; } return 0; }
4 Answers
+ 3
Revise topics about assigning, input taking,...
n = w, x, y, z; is incorrect..
cin >> w, x, y, z ; error. Must be like
cin >> w >> x >> y >> z ;
Next statement is also incorrect.
And also where is your calculations to finding polindrome actually?
+ 2
int n,w,x,y,z,a;
n = w,x,y,z;
cin >> w,x,y,z;
a = z,y,x,w;
Why you taking multiple inputs and you cannot do like this in CPP
a= z,y,x,w // not valid it will assign to single value might be some compiler will work fine but only z will be assign to a
a= (z,y,x,w) // valid but value will assign from left to right so final value w will be assign to a variable
0
Okay, thanks I saw it online and tried it but it only worked for half of the test but I have found a solution now
0
And I will revise assigning of inputs, thanks