Hi, I'm new at programming and I made this little program to test myself... but it didn't work! The problem seems to be at the end with the if/else statement. It always says "You're right!". Thanks in advance!
Code:
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
struct gamelibrary {
int gamecube;
int playstation;
int xbox;
};
gamelibrary john;
cout<< "How many gamecube games does John have?\n";
cin>> john.gamecube;
cout<< "How many playstation games does John have?\n";
cin>> john.playstation;
cout<< "How many xbox games does John have?\n";
cin>> john.xbox;
cout<< "So John has "<< john.gamecube <<" gamecube games, right?\n";
cout<< "1. Yes\n2. No\n";
cin>> a;
cin.get();
if (a = 1){
cout<< "You're right!";
}
else {
cout<< "You're wrong!";
}
cin.get();
}