Hy Guys,I Need Your Help Regarding This Question..
I run this Program on Dev c++ and Compiler did not Show Error but During INput I can not input Name and Address in both student class and School Class..
Sorry For bad English.. :)
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
class school{
char name[50],address[50];
int regdno,totalstudents;
public:
void input()
{
cout<<endl<<endl<<endl;
cout<<"<<<<<<<<--------Input School Information--------->>>>>>>>>";
cout<<endl<<endl<<endl;
cout<<"Enter Regd.No Of school : ";
cin>>regdno;
cout<<"Enter Name Of school : ";
cin.getline(name,50);
cout<<"Enter Address Of school : ";
cin.getline(address,50);
cout<<"Enter Total No.of Students in School : ";
cin>>totalstudents;
}
void output()
{
cout<<endl<<endl<<endl;
cout<<"<<<<<<<<--------School Information--------->>>>>>>>>";
cout<<endl<<endl<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Address : "<<address<<endl;
cout<<"Redg.No : "<<regdno<<endl;
cout<<"Total No Of Students : "<<totalstudents<<endl;
}
// ~ ool();
};
class student //:public ool
{
char name[50],fname[50],address[50];
int rollno;
long long contactno;
public:
/* student()
{
name=NULL;
fname=NULL;
address=NULL;
rollno=0;
contactno=0;
}*/
void studentinput()
{
cout<<endl<<endl<<endl;
cout<<"<<<<<<<<--------Input Student Information--------->>>>>>>>>";
cout<<endl<<endl<<endl;
char arr[50];
cout<<"Enter Name Of Student : ";
cin.getline(name,50);
cout<<"Enter Father Name : ";
cin.getline(fname,50);
cout<<"Enter Roll NO Of Student : ";
cin>>rollno;
cout<<"Enter Address Of Student : ";
cin.getline(address,50);
cout<<"Enter Contact No Of Student : ";
cin>>contactno;
}
void studentoutput()
{
cout<<endl<<endl<<endl;
cout<<"<<<<<<<<--------Student Information--------->>>>>>>>>";
cout<<endl<<endl<<endl;
cout<<"Name : "<< name<<endl;
cout<<"Father Name : "<< fname<<endl;
cout<<"Roll No : "<< rollno<<endl;
cout<<"Address : "<< address<<endl;
cout<<"Contact No : "<< contactno<<endl;
}
};
int main()
{
int repeat;
student st;
school sc;
sc.input();
st.studentinput();
st.studentoutput();
sc.output();
system("pause");
}