I'm having a problem on this one. using a for loop i need to make a user guess a number from 1-10 with only three tries,,, the correct number is 3 . It's running and all but it keeps showing the cout 'Your password is correct' & Program Over everytime. suggestions pls.
#include<iostream.h>
main()
{
int i, pass;
cout<<"\n\t Enter a number:";
for(i=1;i<=1;i++)
{
cin>>pass;
}
{
if (pass==3)
{
cout<<"\n\t The password you entered is correct";
}
else
{
cout<<"\n\t Enter a number:";
cin>>pass;
}
if (pass==3)
{
cout<<"\n\t The password you entered is correct";
}
else
{
cout<<"\n\t Enter a number:";
cin>>pass;
i++;
}
{
cout<<"\n\t Program Over!!!";
}
}
return 0;
}