Hi everyone, my 1st post new to C++ ,working through tutorials on my own. have a ? about my simple loop program called password, It seems to work but only if user inputs a (int), I try a char and it loops, anyone tell me why ?
sorry if wrong post style, work on it, flame away.
#include <iostream>
using namespace std;
int main()
{
for ( int s = 0; s < 26; s = s + 5 ) {
cout<< s <<endl;
}
cin.get();
// MY 1st PASSWORD PROGRAM STARTS HERE
int pw = 1313; // varible set (int)
cout<<"Enter password: "; // asks user for a password
cin>> pw; // user input
cin.ignore();
while ( pw != 1313 ){ // if pw incorrect
cout<<"Sorry thats incorrect "<<endl; // statement for incorrect
cin.ignore();
pw++;
cout<<"Reenter password: ";
cin>> pw;
}
if ( pw == pw ){ // if input correct (pw) print statement
cout<<"Your in"<<endl; // statement for correct answer
cout<<"You have unlocked the secret of the universe ";
}
cin.get();
}