0

Can someone help me with this code?

#include <iostream> using namespace std; int main(){ int SomeThing[2][5] = {{0,2,4,6,8},{1,3,5,7,9}}; int x; cout<<"Choose a number between 0 and 9 and recive a information about that number.\n"; cin>>x; if(x=SomeThing[0][0] || x=SomeThing[0][1] || x=SomeThing[0][2] || x=SomeThing[0][3] || x=SomeThing[0][4] || x=SomeThing[0][5]){ cout<<"The number you chose is even.\n"; } else{ cout<<"The number you chose is odd.\n"; } return 0; }

12th Jul 2018, 12:03 AM
Gabriel
1 Answer
+ 1
#include <iostream> int main () { std::cout << "Enter a number > "; int nn; std::cin >> nn; std::cout << std::endl; if (nn % 2 == 0) { std::cout << "Even number.\n"; return 0; } std::cout << "Odd number.\n"; return 0; } ^Much less time wasted. Anything you don't understand, ask.
12th Jul 2018, 12:45 AM
non