Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
122 views3 pages

C++ Account Management System

This C++ program defines an Account class with methods to display a login menu, perform login, registration, and password recovery functions. The display method shows a menu and uses a switch statement to call the appropriate method based on the user's selection. The login method checks user input against a records file to validate credentials. The registration method appends new user information to the file. The program demonstrates basic user account management functionality.

Uploaded by

Ali Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views3 pages

C++ Account Management System

This C++ program defines an Account class with methods to display a login menu, perform login, registration, and password recovery functions. The display method shows a menu and uses a switch statement to call the appropriate method based on the user's selection. The login method checks user input against a records file to validate credentials. The registration method appends new user information to the file. The program demonstrates basic user account management functionality.

Uploaded by

Ali Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include<iostream>

#include<fstream>
#include<string>
using namespace std;
class ACCOUNT {
public:
void display();
void login();
void resigtration();
void forgot();
};
void ACCOUNT::display() {
int c;
cout << "\t\t\t--------------------------\n\n\n";
cout << "************Welcome to the login page************\n\n\n";
cout << "************MENU************\n\n\n";
cout << " |" << endl;
cout << "\t Press 1 to login |" << endl;
cout << "\t Press 2 to REGISTER |" << endl;
cout << "\t Press 3 to Recover account |" << endl;
cout << "\t Press 4 to Exit |" << endl;
cin >> c;
cout << endl;
switch (c) {
case 1:
login();
break;
case 2:
resigtration();
break;
case 3:
forgot();
break;
case 4:
cout << "\t\t\t Thankyou!!!!!!!\n\n";
break;
default:
system("cls");
cout << "PLEASE SELECT FROM THE OPTION GIVEN ABOVE \n" << endl;
//main();
}
}
void ACCOUNT::login() {
int count;
string userId, password, id, pass;
system("cls");
cout << "PLSEAE ENTER THE USERNAME AND PASSWORD\t\t\t" << endl;
cin >> userId;
cout << "\t\t\tPassword";
cin >> password;
ifstream input("records.txt");
while (input >> id >> pass)
{
if (id == userId && pass == password) {
count = 1;
system("cls");
}
}
input.close();
if (count == 1) {
cout << userId << "\n Your LOGIN is succesfull \n Thanks for logging in!!!!\n";
//main();
}
else {
cout << "\n LOGIN ERROR \nPlease check your username and password\n";
//main();
}
}
void ACCOUNT::resigtration() {
string ruserId, rpassword, rid, rpass;
system("cls");
system("COLOR 05");
cout << "\t\t\tEnter the username:";
cin >> ruserId;
system("COLOR 04");
cout << "\t\t\tEnter the password:";
cin >> rpassword;
ofstream f1("records.txt", ios::app);
f1 << ruserId << "" << rpassword << endl;
system("cls");
system("COLOR 02");
cout << "\n\t\t******RESGISTRATION SUCCESFUL\n";
//main();
}
/*void ACCOUNT::forgot() {
int option;
system("cls");
cout << "\t\t\tYOU FORGOT THE PASSWORD?NO WORRIES\n";
cout << "PRESS 1 TO SEARCH YOUR ID BY USERNAME" << endl;
cout << "PRESS 2 TO GO BACK" << endl;
cout << "****ENTER YOUR CHOICE!!" << endl;
cin >> option;
switch (option) {
case 1:
int count = 0;
string suserId, sId, spass;
cout << "\n\t\tEnter the username which you remembered:";
cin >> suserId;
ifstream f2("records.txt");
while (f2 >> sId >> spass) {
if (sId == suserId) {
count = 1;
}
}
f2.close();
if (count == 1) {
cout << "\n\n Your ACCOUNT IS FOUND\n";
cout << "\n\nYour Password is " << spass;
}
else {
cout << "SORRY YOUR ACCOUNT WAS NOT FOUND" << endl;
}
break;
case 2:
{
//main();
default:
cout << "\t\t\t WRONG CHOICE !!Please try again" << endl;
forgot();
}
}

}
*/
int main() {
ACCOUNT a1;
a1.display();
a1.login();
a1.resigtration();

You might also like