HELP ME RUN THIS CODE... PLEASE Create a login and Registration System in c++ #include #include #include using namespace std; void login(); void registration(); void forgot(); int main() { int c; cout<<"\t\t\t\t-----------------------\n"; cout<<"\t\t\t\t| WELCOME TO |\n"; cout<<"\t\t\t\t-----------------------\n"; cout<<"\t\t\t\t*********MAIN MENU*****\n"; cout<<"\t\t\t----------------------------------------\n"; cout<<"\t\t\t|Pres 1 to Login |"<>c; cout<> userID; cout<<"\t\t\t Password"<>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; cout<<"\t\t\t Enter the Password "<>password; ofstream f1 ("records.txt",ios::app); cout<>choice; switch(choice) { case 1: int count=0; string suserID, spass_word, sid, spass; cout<<" Enter 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\n Your Password is:"<
HELP ME RUN THIS CODE...
PLEASE
Create a login and Registration System in c++
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
void login();
void registration();
void forgot();
int main()
{
int c;
cout<<"\t\t\t\t-----------------------\n";
cout<<"\t\t\t\t| WELCOME TO |\n";
cout<<"\t\t\t\t-----------------------\n";
cout<<"\t\t\t\t*********MAIN MENU*****\n";
cout<<"\t\t\t----------------------------------------\n";
cout<<"\t\t\t|Pres 1 to Login |"<<endl;
cout<<"\t\t\t|Pres 2 to Register |"<<endl;
cout<<"\t\t\t|Pres 3 If you forgot your password |"<<endl;
cout<<"\t\t\t|Pres 4 to Exit |"<<endl;
cout<<"\t\t\t----------------------------------------\n";
cout<<" \t\t\t\tEnter your Choice "<<endl;
cin>>c;
cout<<endl;
switch(c)
{
case 1: login();
break;
case 2: registration();
break;
case 3: forgot();
break;
case 4:
cout<<"\t\t\t Thank you!\n\n";
break;
default:
cout<<"\t\t\t Please Select From the Option Given Above\n\n";
}
main();
}
void login()
{
int count;
string userID, password, id, pass;
system("cls");
cout<<"\t\t\t Please Enter Username and Password"<<endl;
cout<<"\t\t\t Username"<<endl;
cin>> userID;
cout<<"\t\t\t Password"<<endl;
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<<"Your Login is Successful\n Thank you for logging in!\n";
main ();
}
else{ cout<<"Login Error\n Please Check your username and password";}}
void registration()
{
string userID, password, id, pass;
system("cls");
cout<<"\t\t\t Enter the Username "<<endl;
cin>>userID;
cout<<"\t\t\t Enter the Password "<<endl;
cin>>password;
ofstream f1 ("records.txt",ios::app);
cout<<userID<<password<<endl;
system("cls");
cout<<"\t\tRegistration is Successful\n";
main();}
void forgot()
{
int choice;
system("cls");
cout<<"\t\t You Forgot Your Password? No Worries\n";
cout<<"\t\t Press 1 to search your id by username"<<endl;
cout<<"\t\t Press 2 to go back to the main menu"<<endl;
cout<<"\t\t Enter your choice";
cin>>choice;
switch(choice)
{
case 1:
int count=0;
string suserID, spass_word, sid, spass;
cout<<" Enter 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\n Your Password is:"<<spass;
main();
}
else{
cout<<"\n\t Sorry your Account is not found!\n";
main();
}
break;}
case 2:
{
main();
}
default:
cout<<"\t\t\t Wrong Choice! Please Try Again"<<endl;
forgot();
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images