Thanks for the replies.
Salem, thanks for the help. I can now not put in a 5 or more digit number, if I do, the loop will run and not stop giving chance to enter a new number. Also, if I enter a 4 digit number, then another 4 digit number that is the same, and check that the second number that the user enters is the same as the first number, it will say that they do not match, whereas it didnt when using 'int'. The same happens with 3, 2 or 1 digit numbers. Please could you see if anything is wrong within this code?
twomers, thank you also, I get the basic idea how to acomplish this now. I tried to run the code you had, but the compiler gave an error with 'VK_RETURN' as it has not been declared as a variable. Am I supposed to replace this with something?
using namespace std;
int main ()
do//set pin loops
loop = 1;
cout<< "Please set 4 digit pin code: ";//set pin
cin.getline ( pin, 5, '\n' ); //enter pin
cout<< "\n\nPlease confirm: ";//confirm pin
cin.getline ( pinconfirm, 5, '\n' );//enter confirmation
if (pin != pinconfirm)//check if passwords match
cout<< "\n\nPasswords do not match, please try again.\n\n\n";
loop = 0; //break loop of setting pin
} while ( loop != 0 );
Help apreciated, thanks.
I have declared 'VK_RETURN' as an int variable, and it works fine, apart from when I press return, it just comes up with an additional star, any ideas? Thanks.