this is my code; am a beginner, i want the is program to ask for username (raymond)and password (1234), which has bin done. but i want the instance were if the wrong username is wrongly inputted you shouldnt be getting the next question for a password..... but most importantly with (if the password is correct at the first stage it should terminate) and if not correct should give u another chance for inputation.
would be very grateful
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int password;
password = 1234;
string username;
string raymond ;
username = raymond;
cout << "Enter username:";
cin >> raymond;
cout <<"\n";
cout << "Enter password:";
cin >> password;
cout <<"\n";
if (password == 1234)
cout << "Access Granted...";
if (password != 1234)
cout << "Access Denied.....Invalid Username/Password:";
RE: Psault; i useed your approach and it came through. thanks a million. what i need now is; Instead of the password showing numbers i rather make it write in asterisk (******)
I personally think it would be better to make it where you put in the username and whether it be right or wrong it still asks for the password. That way its more realistic. For example:
Enter Username: bob
Enter Password: 1234
Wrong Username or Password