Can't find what's wrong with my code.

Started C++ Programming yesterday, been reading like mad and developing this code in Dev-C++ as I learned more.
It started as a simple Modulus Calculator, then I made it ask for the factor and tell you whether your input was "true" or "false".
I'm currently trying to display the message "Good Job!" for the outcome of "true"
and make it display "You Fail!" for the outcome of "false".
How ever I have noticed two problems:
1) When you put in a value that is too large (not sure how large it can be before this happens) it automatically fills in a factor for you and tells you it's "false".
2) Regardless of whether the outcome is "true"or "false" it gives the "Good Job!" message.
(There's more after the code)
The Code Is :

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int x;
cout << "Try to guess the modulus factor!" << endl;
cout << "Input X Value:";
cin >> x;


int factor = 5;


int y = x % factor;


cout << "Your Y Value Is:";
cout << y << endl;


cout << "So what's the Factor?" << endl;
int input;
cin >> input;

cout.setf(cout.boolalpha);


bool b;
b = factor == input;
cout << "The statement, " << factor
<< " equals " << input
<< " is " << b
<< endl;

if (int input = 5)
{
cout << " Good Job! ";
}
else
{
cout << "You Fail! ";
}

system("PAUSE");
return 0;
}


Any corrections (with explanations) that you can present or any advice to guide me in the right direction (not trying to have it written for me) would be helpful.
I'll also take any advice with regards to any already-functioning part of the code.
if (int input = 5)
What you're doing here is to declare an int variable, initialize it to 5 and use its value as the if condition. And non-zero integral values are converted to true.
What you meant is if (input==5)
This gives me an error message
: Expected primary-expression before "int"
I searched forum's for that, but I can't tell what's relative. But it's nice to know that arrays can't be defined with variables or whatever :O. More help?
Like I said, it should be if (input==5)
It sounds as if you wrote if (int input==5)
o.o You're correct. Thank you :]
Topic archived. No new replies allowed.