getline, while, string problems
k so i made a simple password program for my computer programing class
(if you really want to see it ask and ill put it up, it works fine)
for ec i can make a program with multiple users but i keep getting this dumb problem
whenever i have something like this
Code:
do
{
cout << "Please enter your name first dude\n";
getline (cin,user1);
cout << "hhm sounds good can you repeat that please\n";
getline (cin,user_check);
if (user1!=user_check)
{
cout << "hhmm nope try again please\n";
}
} while (user1!=user_check);
pretty simple stuff it works fine but when i do this
Code:
if (number_users==3)
{
do
{
cout << "Please enter your name first dude\n";
getline (cin,user1);
cout << "hhm sounds good can you repeat that please\n";
getline (cin,user_check);
if (user1!=user_check)
{
cout << "hhmm nope try again please\n";
}
} while (user1!=user_check);
}
(my indentation got messed up when i pasted)
and number_users is not a constant but a user input number it runs through and shows
Code:
Please enter your name firs dude
hhm sounds good can you repeat that please
the first time through, it doesnt let me input anything,
but when number_users is a constat that =3 its fine?
so whats going on here?
becosue this is agrevating. so what am i missing what dont i know that is causing this.
help would be much appreciated. yup show this noob how this works please.
i can do the rest by myself but this is the part that just wont come out right