please i need help with my code below, when ever i enter a wrond password first it gives me an error which its suppose to, but when entering the correct code next it still gives me an error message. could someone help me counter this problem. cheers
#include "stdafx.h"
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string Username;
string Password;
int terminator = 0, terminate = 0;
char encrypt;
while (terminate < 2)
{
cout << "Username: ";
getline(std::cin, Username);
if (Username == "Raymond")
{
terminate = terminate + 3;
while (terminator < 2)
{
cout << "Password: ";
encrypt = _getch();
while(encrypt != 13)
{
Password.push_back(encrypt);
cout << '*';
encrypt = _getch();
}
if (Password == "123456")
{
cout << "\n Welcome Raymond.... \n ";
terminator = terminator + 3;
}
else
{
cout << "invalid password. Please enter valid password." << std::endl;
cout << "\a\n";
terminator = terminator + 1;
}
}
} else {
cout << "invalid username. Please enter valid username." << std::endl;
cout << "\a\n";
terminate = terminate + 1;
}
}
return 0;
}