This Banking System is develop by student of UAAR IT department .This program is created in C++ using object oriented approach (OOP Classes) with file writing. In this system you can create a bank account and you get a unique BANK id using that id you can deposit and withdraw money from bank and check your balance. Administrator also can edit,search and delete the user .
Every user details written in file and can be access anytime. No data lose when program ended :)
JOIN US ON FACEBOOK
#include<iostream>
#include<string>
#include<fstream>
#include<windows.h>
using namespace std;
enum COLOR
{
black , blue , green , cyan , red , magenta , brown , normal , darkgrey , lightblue ,
lightgreen , lightcyan , lightred , lightmagenta , yellow , white
};
ostream& operator<<( ostream &stm , const COLOR &c)
{
HANDLE out_handle = GetStdHandle( STD_OUTPUT_HANDLE );
SetConsoleTextAttribute( out_handle , c );
return( stm );
}
class Student
{public:
string name,cnic,nationality,gender;
int age;
public:
Student (){}
void input()
{
ofstream outfile;
outfile.open("Student.txt",ios :: out);
cout<<"Enter Name (End with Dot) \t= ";
getline(cin,name,'.');
outfile<<name<<"\t";
cout<<"Enter Age \t= ";
cin>>age;
outfile<<age<<"\t";
cout<<"Enter Gender (End with Dot)\t=";
getline(cin,gender,'.');
outfile<<gender<<"\t";
cout<<"Enter CNIC (End with Dot)\t=";
getline(cin,cnic,'.');
outfile<<cnic<<"\t";
cout<<"Enter Nationality (End with Dot)\t= ";
getline(cin,nationality,'.');
outfile<<nationality<<"\t";
outfile.close();
}
void student_info()
{
string Reg_No,Reg_No1;
int check,search_Num=0;
cout<<"Enter Student Registration No=";
cin>>Reg_No1;
fstream infile;
infile.open("Check.txt",ios::in);
while(!infile.eof())
{
infile>>Reg_No;
infile>>name;
infile>>age;
infile>>gender;
infile>>cnic;
infile>>nationality;
infile>>check;
{
if (Reg_No1==Reg_No)
{
system("cls");
cout<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<lightcyan<<"Name="<<name<<endl;
cout<<lightgreen<<"Reg_No="<<Reg_No<<endl;
cout<<"Age="<<age<<endl;
cout<<"Gender="<<gender<<endl;
cout<<"CNIC="<<cnic<<endl;
cout<<"Nationality="<<nationality<<endl<<endl;
cout<<endl;
if (check==0)
{
cout<<lightcyan<<"Your Subject are......\n"<<endl;
string course,teacher;
ifstream file;
file.open("Semester_1.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
}
else if (check==1)
{
cout<<"You are Passed in First Semester....\n"<<endl;
cout<<lightcyan<<"Now Your Subject are......\n"<<endl;
string course,teacher;
ifstream file2;
file2.open("Semester_2.txt",ios::in);
if (!file2)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file2>>course;
file2>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file2.close();
}
else if (check==2)
{
cout<<"You are Passed in Second Semester....\n"<<endl;
cout<<lightcyan<<"Now Your Subject are......\n"<<endl;
string course,teacher;
ifstream file3;
file3.open("Semester_3.txt",ios::in);
if (!file3)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file3>>course;
file3>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file3.close();
}
else if (check==3)
{
cout<<"You are Passed in Second Semester....\n"<<endl;
cout<<lightcyan<<"Now Your Subject are......\n"<<endl;
string course,teacher;
ifstream file4;
file4.open("Semester_4.txt",ios::in);
if (!file4)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file4>>course;
file4>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file4.close();
}
cout<<lightgreen<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<endl<<endl;
search_Num++;
}
}
}
if (search_Num==0)
{
system("cls");
cout<<"Please Enter Correct Registration Number......\n"<<endl;
student_info();
}
infile.close();
}
void student_Grade() //for checking Student Grade
{
system("cls");
string itc,pf,dm,c1,e1; //subject variables
string Reg_No,Reg_No1;
int check,search_Num=0;
int num;
ifstream file;
file.open("Number.txt",ios::in);
file>>num;
file.close();
cout<<"Enter Student Registration No=";
cin>>Reg_No1;
fstream infile;
infile.open("Check.txt",ios::in);
for (int i=0;i<num-1;i++)
{
infile>>Reg_No;
infile>>name;
infile>>age;
infile>>gender;
infile>>cnic;
infile>>nationality;
infile>>check;
{
if (Reg_No1==Reg_No)
{
if (check==2)
{
system("cls");
cout<<lightcyan<<"You are in 2nd Semester........\n"<<endl;
cout<<"Enter Subject Grade Below....\n"<<endl;
cout<<lightgreen<<"Major World Religion=";
cin>>itc;
/*if ((itc!="F")||(itc!="A")||(itc!="B")||(itc!="C")||(itc!="D"))
{
cout<<lightcyan<<"Please enter coorect grade...."<<endl;
cout<<"Inttoduction To Computing=";
cin>>itc;
}*/
cout<<"Psycology=";
cin>>pf;
cout<<"Applied Equation=";
cin>>dm;
cout<<"Circuit Design=";
cin>>c1;
cout<<"Algorithm=";
cin>>e1;
//if student pass in all subject
if ((itc=="F")||(pf=="F")||(dm=="F")||(c1=="F")||(e1=="F"))
{
cout<<"\n\t\tSorry...You are Fail in some courses......\n"<<endl;
}
else
{
system("cls");
cout<<"\t\t ****** Congratulation you are pass in all subject *******\n"<<endl;
check++;
cout<<lightred<<"Now Your Subject Are..........\n"<<endl;
cout<<lightcyan;
string course,teacher;
ifstream file;
file.open("Semester_4.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
cout<<lightgreen<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<endl<<endl;
}
}//end check loop
else if (check==1)
{
system("cls");
cout<<lightcyan<<"You are in 2nd Semester........\n"<<endl;
cout<<"Enter Subject Grade Below....\n"<<endl;
cout<<lightgreen<<"Digital Logic Design=";
cin>>itc;
/*if ((itc!="F")||(itc!="A")||(itc!="B")||(itc!="C")||(itc!="D"))
{
cout<<lightcyan<<"Please enter coorect grade...."<<endl;
cout<<"Inttoduction To Computing=";
cin>>itc;
}*/
cout<<"Object Oriented Programming=";
cin>>pf;
cout<<"Linear Algebra=";
cin>>dm;
cout<<"Calculus-II=";
cin>>c1;
cout<<"English-II=";
cin>>e1;
//if student pass in all subject
if ((itc=="F")||(pf=="F")||(dm=="F")||(c1=="F")||(e1=="F"))
{
cout<<"\n\t\tSorry...You are Fail in some courses......\n"<<endl;
}
else
{
system("cls");
cout<<"\t\t ****** Congratulation you are pass in all subject *******\n"<<endl;
check++;
cout<<lightred<<"Now Your Subject Are..........\n"<<endl;
cout<<lightcyan;
string course,teacher;
ifstream file;
file.open("Semester_3.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
cout<<lightgreen<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<endl<<endl;
}
}//end check loop
else if (check==0)
{
system("cls");
cout<<"Enter Subject Grade Below....\n"<<endl;
cout<<"Inttoduction To Computing=";
cin>>itc;
/*if ((itc!="F")||(itc!="A")||(itc!="B")||(itc!="C")||(itc!="D"))
{
cout<<lightcyan<<"Please enter coorect grade...."<<endl;
cout<<"Inttoduction To Computing=";
cin>>itc;
}*/
cout<<"Programming Fundamental=";
cin>>pf;
cout<<"Discreate Mathematics=";
cin>>dm;
cout<<"Calculus-I=";
cin>>c1;
cout<<"English-I=";
cin>>e1;
/*while ((e1=="F")||(e1=="A")||(e1=="B")||(e1=="C")||(e1=="D"))
{
cout<<"Please enter coorect grade...."<<endl;
cout<<"English-I=";
cin>>e1;
}*/
//if student pass in all subject
if ((itc=="F")||(pf=="F")||(dm=="F")||(c1=="F")||(e1=="F"))
{
cout<<"\n\t\tSorry...You are Fail in some courses......\n"<<endl;
}
else
{
system("cls");
cout<<"\t\t ****** Congratulation you are pass in all subject *******\n"<<endl;
check++;
cout<<lightred<<"Now Your Subject Are..........\n"<<endl;
string course,teacher;
ifstream file;
file.open("Semester_2.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
cout<<lightgreen<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<endl<<endl;
}
}//end check loop
} //end Reg_No loop
}
ofstream datafile;
datafile.open("Copy_check.txt",ios::app);
datafile<<Reg_No<<"\t";
datafile<<name<<"\t";
datafile<<age<<"\t";
datafile<<gender<<"\t";
datafile<<cnic<<"\t";
datafile<<nationality<<" ";
datafile<<check<<endl;
datafile.close();
}
//for doing check file blank
fstream datafile2;
datafile2.open("check.txt",ios::out);
datafile2.close();
//for copy "Copy_check" file in Student file
{
ifstream infile2;
infile2.open("Copy_check.txt",ios::in);
for (int i=0;i<num-1;i++)
{
infile2>>Reg_No;
infile2>>name;
infile2>>age;
infile2>>gender;
infile2>>cnic;
infile2>>nationality;
infile2>>check;
{
ofstream datafile1;
datafile1.open("check.txt",ios::app);
datafile1<<Reg_No<<"\t";
datafile1<<name<<"\t";
datafile1<<age<<"\t";
datafile1<<gender<<"\t";
datafile1<<cnic<<"\t";
datafile1<<nationality<<" ";
datafile1<<check<<endl;
datafile1.close();
}
}
infile2.close();
}
//for doing "Copy_check" file blank
fstream datafile3;
datafile3.open("Copy_check.txt",ios::out);
datafile3.close();
}
};
class Courses
{
Student s;
public:
void info()
{
string course,teacher;
ifstream file;
file.open("Semester_1.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
}
void copy_Student()
{
//for doing blank check file
/*{
fstream datafile2;
datafile2.open("check.txt",ios::out);
datafile2.close();
}*/
int num;
/*int num=0;*/
ifstream infile;
infile.open("Student.txt",ios::in);
for (int i=0;i<1;i++)
{
infile>>s.name;
infile>>s.age;
infile>>s.gender;
infile>>s.cnic;
infile>>s.nationality;
/*infile>>num;*/
{
ifstream file1;
file1.open("Number.txt",ios::in);
if (!file1)
{
cout << "Error opening file.\n";
return;
}
file1>>num;
file1.close();
}
int check=0;
fstream datafile;
datafile.open("check.txt",ios::app);
datafile<<"13-Arid-1700"<<num<<"\t";
datafile<<s.name<<"\t";
datafile<<s.age<<"\t";
datafile<<s.gender<<"\t";
datafile<<s.cnic<<"\t";
datafile<<s.nationality<<" ";
datafile<<check<<endl;
datafile.close();
num++;
ofstream outfile;
outfile.open("Number.txt",ios::out);
outfile<<num;
outfile.close();
}
infile.close();
}
void semester_detail()
{
system("cls");
string Reg_No;
int num,search_num=0;
int check;
ifstream infile;
infile.open("Number.txt",ios::in);
infile>>num;
{ ofstream datafile;
datafile.open("Reg_num.txt",ios::out);
datafile<<"13-Arid-1700"<<num-1;
datafile.close(); }
infile.close();
ifstream fin;
string data;
fin.open("Reg_num.txt",ios::in);
fin>>data;
fin.close();
ifstream infile1;
infile1.open("Check.txt",ios::in);
for (int i=0;i<num-1;i++)
{
infile1>>Reg_No;
infile1>>s.name;
infile1>>s.age;
infile1>>s.gender;
infile1>>s.cnic;
infile1>>s.nationality;
infile1>>check;
if (search_num==0)
{
if (data==Reg_No)
{
cout<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<lightcyan<<"Hello "<<s.name<<" Welcome to our University\n"<<endl;
cout<<red<<"Your General info is.......\n"<<endl;
cout<<lightgreen<<"Reg_No="<<Reg_No<<endl;
cout<<"Age="<<s.age<<endl;
cout<<"Gender="<<s.gender<<endl;
cout<<"CNIC="<<s.cnic<<endl;
cout<<"Nationality="<<s.nationality<<endl<<endl;
cout<<endl;
cout<<lightcyan<<"Your Subject are......\n"<<endl;
string course,teacher;
ifstream file;
file.open("Semester_1.txt",ios::in);
if (!file)
{
cout << "Error opening file.\n";
return;
}
for (int i=0;i<5;i++)
{
file>>course;
file>>teacher;
cout<<course<<"\t By \t";
cout<<teacher<<endl;
}
file.close();
cout<<lightgreen<<"\t\t************************************************"<<endl;
cout<<"\t\t************************************************"<<endl;
cout<<endl<<endl;
search_num++;
}
}
}
infile1.close();
}
};
void option()
{
char choice2;
//for create Personl account types
cout<<"\n\n\n";
cout<<lightgreen<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 ";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \n";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 ";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \n";
cout<<"\x5\x5 \t\t \t \x5\x5\n";
cout<<"\x5\x5";
cout<<yellow<<" To \t To \t To \t ";
cout<<lightgreen<<"\x5\x5\n\x5\x5";
cout<<yellow<<" Register check \t Enter \t ";
cout<<lightgreen<<"\x5\x5\n\x5\x5";
cout<<yellow<<" Students Students\tStudents \t ";
cout<<lightgreen<<"\x5\x5\n\x5\x5";
cout<<yellow<<" \t \t Info \t Grade \t ";
cout<<lightgreen<<"\x5\x5\n\x5\x5 \t\t \t \x5\x5\n";
cout<<"\x5\x5 \x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t \x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t";
cout<<"\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t \x5\x5\n";
cout<<"\x5\x5 | ";
cout<<lightred<<"Press R ";
cout<<lightgreen<<"|\t | ";
cout<<lightred<<"Press I ";
cout<<lightgreen<<"|\t| ";
cout<<lightred<<"Press G ";
cout<<lightgreen<<"| \x5\x5\n";
cout<<lightgreen<<"\x5\x5 \x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t \x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t";
cout<<"\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5 \t \x5\x5\n";
cout<<"\x5\x5 \t\t \t \x5\x5\n";
cout<<lightgreen<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 ";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \n";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 ";
cout<<"\x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \x5 \n";
cout<<endl;
cout<<lightgreen<<"\t\tPress Any Key=\t";
cin>>choice2;
switch(choice2)
{
case 'R': case 'r':
{
system("cls");
Student s;
s.input();
Courses c;
c.copy_Student();
c.semester_detail();
char choice;
cout<<"Press M to Main Menu or Press Any key to terminate program=";
cin>>choice;
if ((choice=='M')||(choice=='m'))
{
system("cls");
option(); }
else
{ cout<<"\t\t********** Thanks for visiting our University ***********\n"<<endl;
}
}
break;
case 'I': case 'i':
{
Student s;
system("cls");
s.student_info();
char choice;
cout<<"Press M to Main Menu or Press Any key to terminate program=";
cin>>choice;
if ((choice=='M')||(choice=='m'))
{
system("cls");
option(); }
else
{ cout<<"\t\t********** Thanks for visiting our University ***********\n"<<endl;
}
}
break;
case 'G': case 'g':
{
Student s;
s.student_Grade();
char choice;
cout<<"Press M to Main Menu or Press Any key to terminate program=";
cin>>choice;
if ((choice=='M')||(choice=='m'))
{
system("cls");
option(); }
else
{ cout<<"\t\t********** Thanks for visiting our University ***********\n"<<endl;
}
}
break;
default:
system("cls");
cout<<lightgreen<<"Please enter a valid key"<<endl;
option(); break;
}
}
void welcome()
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\t";
Sleep(100);cout<<red<<"*";Sleep(100);cout<<"*";
Sleep(100);cout<<"*";Sleep(100);cout<<"*";Sleep(100);cout<<" ";
Sleep(100);cout<<lightgreen<<"W";Sleep(100);cout<<"E";
Sleep(100);cout<<"L";Sleep(100);cout<<"L";
Sleep(100);cout<<"C";Sleep(100);cout<<"O";
Sleep(100);cout<<"M";Sleep(100);cout<<"E";
Sleep(100);cout<<" ";Sleep(100);cout<<cyan<<"T";
Sleep(100);cout<<"O";Sleep(100);cout<<" ";Sleep(100);cout<<yellow<<"A";
Sleep(100);cout<<"R";Sleep(100);cout<<"I";
Sleep(100);cout<<"D";Sleep(100);cout<<lightgreen<<" ";
Sleep(100);cout<<"U";Sleep(100);cout<<"N";
Sleep(100);cout<<"I";Sleep(100);cout<<"V";Sleep(100);cout<<lightcyan<<"E";
Sleep(100);cout<<"R";Sleep(100);cout<<lightgreen<<"S";Sleep(100);cout<<"I";
Sleep(100);cout<<red<<"T";Sleep(100);cout<<"Y";
Sleep(100);cout<<" *";Sleep(100);cout<<"*";Sleep(100);cout<<"*";Sleep(100);cout<<"*";
Sleep(100);cout<<" ";Sleep(100);cout<<" ";Sleep(100);cout<<" ";
Sleep(100);cout<<" ";Sleep(100);cout<<" ";Sleep(100);cout<<" ";
Sleep(100);cout<<" ";Sleep(100);cout<<" ";Sleep(100);cout<<lightcyan<<" ";
system("cls");
}
void main()
{
welcome();
option();
system("pause");
}