char TEMP_PASSWORD[7];
char PASSWORD[] = "natale";
int choice;
std::cout << "Enter Your Password: ";
std::cin >> TEMP_PASSWORD;
if (strcmp(PASSWORD, TEMP_PASSWORD))
{
std::cout << "\nYou have entered an invalid password. Please contact Phillip Vaira ";
std::cout << "at \nphil@webula.net if the problem persists." << std::endl;
std::cout << "\nTry again? (1/0): ";
std::cin >> choice;
if (choice == 1)
{
main();
}
if (choice == 0)
{
exit(1);
}
}
Getting Input (y/n) instead of (1/0)
I realized it''s a bit trickier. Can you give me a code example so the user can type in "y" or "n"?
why dont you just do
char temp
std::cin >> temp;
if(temp == 'y')
choice = 1;
else choice = 0;
if (choice == 1)
{
main();
}
if (choice == 0)
{
exit(1);
}
[edited by - graveyard filla on March 27, 2004 4:25:59 PM]
char temp
std::cin >> temp;
if(temp == 'y')
choice = 1;
else choice = 0;
if (choice == 1)
{
main();
}
if (choice == 0)
{
exit(1);
}
[edited by - graveyard filla on March 27, 2004 4:25:59 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement