Welcome to Home.

Monday, February 22, 2016

School Data Managment Project in C++ Programming Language

#include<iostream.h>
#include<conio.h>
char s_name[10];
class student
{
  public:
  char address[10],contact[10];
  void info()
  {


cout<<"Enter the student name:"<<endl;
cin>>s_name;
cout<<"Enter the student address:"<<endl;
cin>>address;
cout<<"Enter the student contact no:"<<endl;
cin>>contact;
cout<<"\n\n\tName of student      :"<<s_name;
cout<<"\n\n\tAddress of student   :"<<address;
cout<<"\n\n\tContact no of student:"<<contact;



}

};
class teacher
{
private:
char name[10],address[20];
int id;
public:
void inf()
{
cout<<"\nEnter the ID of teacher:"<<endl;
cin>>id;
cout<<"Enter the teacher name:"<<endl;
cin>>name;
cout<<"Enter the address of teacher:"<<endl;
cin>>address;
cout<<"======================================================"<<endl;
cout<<"\n\t\t\tId of teacher is     :"<<id<<endl;
cout<<"\n\t\t\tName of teacher is   :"<<name<<endl;
cout<<"\n\t\t\tAddress od teacher is:"<<address<<endl;
cout<<"======================================================"<<endl;

cout<<s_name<<"   is teached by " <<name<<"  teacher"<<endl;
}
 };
 class department
 {
private:
char teac_name,stu_name;
int lab;
int com;
int stu;
public:
void set1()
{
cout<<"Which department of info do you want"<<endl;
cout<<"1.Computer lab"<<endl;
cout<<"2.Science lab"<<endl;
cout<<"3.Electrical lab"<<endl;
cin>>lab;
if(lab==1)
{
 cout<<"Enter the name of teacher who teach in computer lab"<<endl;
 cin>>teac_name;
 cout<<"How many computer are there?"<<endl;
 cin>>com;
 cout<<"How many student can sit in computer lab"<<endl;
 cin>>stu;
 for(int i=0;i<2;i++)
 {
 cout<<"Enter the name of student"<<endl;
 cin>>stu_name;

 }
}

 cout<<"Name of teacher in computer lab:"<<teac_name<<endl;
 cout<<"The number of computer are:"<<com<<endl;
 cout<<"The number of student are:"<<stu<<endl;
 cout<<"Name of student in computer lab:"<<stu_name;
}
};
void main()
{
  clrscr();
 student obj;
 teacher obj1;
 department obj2;
 line1:
 int choice=0;
 char choose=0;

 cout<<"\n\t\t\tEnter the following option:"<<endl;
 cout<<"\t\t\t==============================="<<endl;
 cout<<"\t\t\t1.Information of student"<<endl;
 cout<<"\t\t\t2.Information of teacher"<<endl;
 cout<<"\t\t\t3.Information of Department"<<endl;
 cout<<"\t\t\t==============================="<<endl;
 cin>>choice;
 switch(choice)
 {
 case 1:
 obj.info();
 break;
 case 2:
 obj1.inf();
 break;
 case 3:
 obj2.set1();
 break;
 default:
 cout<<"Invalid choice"<<endl;
 }
 cout<<"\nDo you want to continue:(y/n)"<<endl;
 cin>>choose;
 if(choose=='y')
 {
 goto line1;
 }
 else
 {
 cout<<"Thanks"<<endl;
 }
getch();
}

No comments:

Post a Comment