please debug this program i need it urgently | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

please debug this program i need it urgently

#incude<conio.h> #include <stdio.h> #include<conio.h> const int LEN=25; class Person char name[LEN]; int age ; public: void readperson(); void displayperson() {cout<<"Name :"; cout.write(name,LEN); cout <<"\tAge :<<age<<"\n"; } }; void Person:: readperson() {for(int i=0;i<LEN;i++) name[i]=' '; cout<<"Enter Name of the person :"; gets(name); cout<<"Enter Age :"; cin>>age; } class Student :public Person { int rollno; float average; public: void readstudent() { readperson(); cout<<"Enter roll number :"; cin>>rollno; cout<<"Enter Average marks :"; cin>>average; } void disp_rollno() {cout<<"Roll numer :"<<rollno<<"\n"; float getaverage(void) {return average ;} }; class GradStudent : public Student {char subject[len]; char working ; public: void readit(void); void displaysubject() {cout<<"Subject:"; cout.write(subject,LEN); } char workstatus () { return working; } }; void GradStudent::readit() {readstudent(); for(int i=0;i<LEN;i++) subject[i]=' '; cout<<"Enter main subject :"; gets(subject); cout<<"Working ?(Y/N)":; cin>>working; } int main() { const int size =5; GradStudent grad[size]; int year ,num_working=0,non_working=0,div=0,total=0; float topscore =0,score,number,wperc,nwperc; cout<<"Enter Year :"; cin>>year; for (int i=0;i<size,i++) {cout<<"Emter details for Graduate"<<(i+1)<<"\n"; grad[i].readit; total++; if(grad[i].workstatus()=='Y')||(grad[i].workstatus()=='Y')) num_working++; else non_working++; score=grad[i].getaverage(); if(score>topscore) { topscore=score ;number=i;} if(score>=60.0) div1++; } i=number; cout<<"\n"<<"\t\tReport for the year"<<year<<"\n"; cout<<"t\t-----------------------\n"; cout<<"Working graduates :"<<non_working<<"\n"; cout<<"\tDetails of the Top scorer \n"; gradi].displayperson(); grad[i].displaysubject(); nwperc=((float)non_working/(float)total)*100; wperc=((float)div1/(float)total)*100; cout<<"\tAverage marks :"<<grad[i].getaverage()<<"\n"; cout<<'\t'<<newperc<<"%of the graduates this yea

21st Oct 2018, 6:32 AM
Umesh Chander
Umesh Chander - avatar
1 Respuesta
0
Its an multi level inheritence solution where first person class is defined and it has some attributes which is further used by student class then student class attribute is used by gradstudent class and then the all information which needed are called in the main function.
21st Oct 2018, 6:46 AM
MsJ
MsJ - avatar