h>
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
using namespace std;
int main(){
// pwd
int pwd;
cout<<"Enter the password.........\n";
cin>>pwd;
if (pwd!=12345)
cout<<"Your Password Is Wrong....... Please Re Try\n";
else
if (pwd==12345)
{
//menu
{
int choice;
system("cls");
cout << " X Y Z University, Student Registration system\n\n";
cout << " M E N U\n";
cout << " = = = =\n";
cout<<"\n 1 :Insert new Student details\n";
cout<<" 2 :View existing Student Registration details\n";
cout<<" 3 :Quit program \n";
cout<<"\nEnter your choice: ";
while (!(cin >> choice) )
{
cout << "\nOOPS !! that's an invalid option."
<< "\nRe-Enter your choice: ";
cin.clear();
fflush(stdin);
}
return choice;
}
#ifdef _WIN32
system ("color 6a");
#endif
//student add
char FileName[20];
char openFileName[20];
string newregistration;
cout<<endl<<endl;
cout <<".....Wellcome to X Y Z University, Student Registration System.....";
cout<<endl<<endl<<endl;
string subject[4];
string firstname;
string lastname;
string nic;
string gender;
string birthday;
string homenumberorname;
string streetname;
string cityname;
string contactnumber;
string emailaddres;
double id;
cout<<"Student New Registration Number\"Should minimum than 250 \" "<<setw(9)<<s
etfill('.')<<":";
cin>>id;
cout<<endl<<endl<<endl<<endl;
cout<<" "<<endl;
cout<<" :::::::::::::............UNIVERSITY..............::::::::::::"<<endl;
cout<<" :::::::::::::................OF..................::::::::::::"<<endl;
cout<<" :::::::::::::...............X Y Z................::::::::::::"<<endl;
cout<<" ______________________________________________________________"<<endl
<<endl<<endl;
cout<<endl<<endl;
cout<<endl;
ifstream infile;
ofstream outfile;
if(id==001){
infile.open("c:\\out_reg_001.doc");
outfile.open("c:\\in_reg_001.doc");
}
if(id==002){
infile.open("c:\\out_reg_002.doc");
outfile.open("c:\\in_reg_002.doc");
}
if(id==003){
infile.open("c:\\out_reg_003.doc");
outfile.open("c:\\in_reg_003.doc");
}
if(id==004){
infile.open("c:\\out_reg_004.doc");
outfile.open("c:\\in_reg_004.doc");
}
if(id==005){
infile.open("c:\\out_reg_005.doc");
outfile.open("c:\\in_reg_005.doc");
}
if(id==006){
infile.open("c:\\out_reg_006.doc");
outfile.open("c:\\in_reg_006.doc");
}
if(id==007){
infile.open("c:\\out_reg_007.doc");
outfile.open("c:\\in_reg_007.doc");
}
outfile<<" Student Registration Number : "<<id<<endl<<endl<<endl;
outfile<<"1. Student First Name "<<setw(20)<<setfill('.')<<": "
<<firstname <<endl<<endl;;
infile.close();
outfile.close();
cout<<endl<<endl;
cout << "\nEnter the name of the file you want to create: ";
cin >> FileName;
ofstream Students(FileName, ios::out);
Students <<id << "\n" <<firstname <<"\n" <<lastname << "\n"<<birthday <<"\n"
<<nic <<"\n" <<gender <<"\n" <<homenumberorname <<"\n" <<contactnumber << "\n"
<<emailaddres <<"\n" <<subject[1] <<"\n" <<subject[2] <<"\n"<<subject[3] <<"\n"
<<subject[4] ;
ifstream (openFileName) >> id >> firstname >> lastname >> nic >> birthday >
> gender >> homenumberorname >> contactnumber >> emailaddres >> subject[1] >> su
bject[2] >> subject[3] >>subject[4];
return (0);
}