Hello World C++
Hello World C++
///////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////
//Headers inclusion
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include <windows.h>
//Structure defining
//For students
struct student
struct teacher
///////////////////////////////////////////////////
//Main function
void main()
string srch;
while(1)//outer loop
system("cls");//Clear screen
cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\";
cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\";
cout<<"\n\n\t\t\tMAIN SCREEN\n\n";
cout<<"1.Students information"<<endl;
cout<<"2.Teacher information"<<endl;
cout<<"3.Exit program"<<endl;
cin>>choice;
system("cls");//Clear screen
switch(choice)//First switch
while(1)//inner loop-1
system("cls");//Clear screen
//Level-2 display
cout<<"\t\t\tSTUDENTS INFORMATION AND BIO DATA SECTION\n\n\n";
cout<<"3.Jump to main\n";
cin>>choice;
{ ofstream f1("student.txt",ios::app);
for( i=0;choice!='n';i++)
if((choice=='y')||(choice=='Y')||(choice=='1'))
cin>>studentData.fname;
cin>>studentData.lname;
cin>>studentData.Registration;
cin>>studentData.classes;
f1<<studentData.fname<<endl<<studentData.lname<<endl<<studentData.Registration<<endl<<
studentData.classes<<endl;
cout<<"Do you want to enter data: ";
cin>>choice;
f1.close();
{ ifstream f2("student.txt");
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;(j<i)||(!f2.eof());j++)
getline(f2,studentData.fname);
if(studentData.fname==find)
notFound = 1;
getline(f2,studentData.Registration);
cout<<"Class: "<<studentData.classes<<endl<<endl;
if(notFound == 0){
f2.close();
}
case '2'://Teachers biodata
while(1)//inner loop-2
system("cls");//Clear screen
cout<<"3.Jump to main\n";
cin>>choice;
ofstream t1("teacher.txt",ios::app);
for(i=0;choice!='n'&& choice!='N';i++)
if((choice=='y')||(choice=='Y')||(choice=='1'))
cin>>tech[i].fst_name;
cin>>tech[i].lst_name;
cin>>tech[i].exp;
cin>>tech[i].serves;
cin>>tech[i].subj;
cin>>tech[i].lec;
cin>>tech[i].pay;
cin>>tech[i].cel_no;
cin>>tech[i].blod_grp;
t1<<tech[i].fst_name<<endl<<tech[i].lst_name<<endl
<<tech[i].qualification<<endl<<tech[i].exp<<endl
<<tech[i].serves<<endl<<tech[i].subj<<endl<<tech[i].lec
<<endl<<tech[i].pay<<endl<<tech[i].cel_no<<endl<<tech[i].blod_grp<<endl;
cin>>choice;
}//if
}//for loop
system("cls");
t1.close();
}//case 1
ifstream t2("teacher.txt");
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;((j<i)||(!t2.eof()));j++)
getline(t2,tech[j].fst_name);
if(tech[j].fst_name==find)
notFound = 1;
getline(t2,tech[j].lst_name);
getline(t2,tech[j].qualification);
cout<<"Qualification: "<<tech[j].qualification<<endl;
getline(t2,tech[j].exp);
cout<<"Experience: "<<tech[j].exp<<endl;
getline(t2,tech[j].serves);
getline(t2,tech[j].subj);
getline(t2,tech[j].lec);
getline(t2,tech[j].pay);
cout<<"pay: "<<tech[j].pay<<endl;
getline(t2,tech[j].addrs);
cout<<"Address: "<<tech[j].addrs<<endl;
getline(t2,tech[j].cel_no);
getline(t2,tech[j].blod_grp);
}//if
}//for loop
t2.close();
if(notFound == 0){
}
cout<<"Press any key two times to proceed";
}//case 2
break;//inner switch
}//case 3
}//inner switch
break;//inner while
}//inner loop
}//outer case 2
case '3':
break;//outer case 3
}//outer case 3
break;//outer loop
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////
//Headers inclusion
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include <windows.h>
//Structure defining
//For students
struct student
//For teachers
struct teacher
///////////////////////////////////////////////////
//Main function
void main()
string srch;
while(1)//outer loop
system("cls");//Clear screen
cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\";
cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\";
cout<<"\n\n\t\t\tMAIN SCREEN\n\n";
cout<<"1.Students information"<<endl;
cout<<"2.Teacher information"<<endl;
cout<<"3.Exit program"<<endl;
cin>>choice;
system("cls");//Clear screen
switch(choice)//First switch
{
while(1)//inner loop-1
system("cls");//Clear screen
//Level-2 display
cout<<"3.Jump to main\n";
cin>>choice;
{ ofstream f1("student.txt",ios::app);
for( i=0;choice!='n';i++)
if((choice=='y')||(choice=='Y')||(choice=='1'))
cin>>studentData.fname;
cin>>studentData.lname;
cin>>studentData.Registration;
f1<<studentData.fname<<endl<<studentData.lname<<endl<<studentData.Registration<<endl<<
studentData.classes<<endl;
cin>>choice;
f1.close();
{ ifstream f2("student.txt");
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;(j<i)||(!f2.eof());j++)
getline(f2,studentData.fname);
if(studentData.fname==find)
notFound = 1;
getline(f2,studentData.Registration);
getline(f2,studentData.classes);
cout<<"Class: "<<studentData.classes<<endl<<endl;
if(notFound == 0){
f2.close();
while(1)//inner loop-2
system("cls");//Clear screen
cout<<"3.Jump to main\n";
cin>>choice;
ofstream t1("teacher.txt",ios::app);
for(i=0;choice!='n'&& choice!='N';i++)
if((choice=='y')||(choice=='Y')||(choice=='1'))
cin>>tech[i].lst_name;
cin>>tech[i].qualification;
cin>>tech[i].exp;
cin>>tech[i].serves;
cin>>tech[i].subj;
cin>>tech[i].lec;
cin>>tech[i].pay;
cin>>tech[i].cel_no;
cin>>tech[i].blod_grp;
t1<<tech[i].fst_name<<endl<<tech[i].lst_name<<endl
<<tech[i].qualification<<endl<<tech[i].exp<<endl
<<tech[i].serves<<endl<<tech[i].subj<<endl<<tech[i].lec
<<endl<<tech[i].pay<<endl<<tech[i].cel_no<<endl<<tech[i].blod_grp<<endl;
cin>>choice;
}//if
}//for loop
//for finding through name
system("cls");
t1.close();
}//case 1
ifstream t2("teacher.txt");
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;((j<i)||(!t2.eof()));j++)
getline(t2,tech[j].fst_name);
if(tech[j].fst_name==find)
notFound = 1;
getline(t2,tech[j].lst_name);
cout<<"Last name: "<<tech[j].lst_name<<endl;
getline(t2,tech[j].qualification);
cout<<"Qualification: "<<tech[j].qualification<<endl;
getline(t2,tech[j].exp);
cout<<"Experience: "<<tech[j].exp<<endl;
getline(t2,tech[j].serves);
getline(t2,tech[j].subj);
getline(t2,tech[j].lec);
getline(t2,tech[j].pay);
cout<<"pay: "<<tech[j].pay<<endl;
getline(t2,tech[j].addrs);
cout<<"Address: "<<tech[j].addrs<<endl;
getline(t2,tech[j].cel_no);
getline(t2,tech[j].blod_grp);
}//if
}//for loop
t2.close();
if(notFound == 0){
}//case 2
break;//inner switch
}//case 3
}//inner switch
break;//inner while
}//inner loop
}//outer case 2
case '3':
break;//outer case 3
}//outer case 3
}
break;//outer loop