Tuesday, July 14, 2009

C++ program to creake base class student (name,reg,age)and find average age,semester wise for ug &pg students?

using inheritance create classes called ugstudents having fields semester and pgstudents having semester and stipend.enter data for atleast 5 students.it should not accept duplicate reg.the semester for ug should be 4%26amp; that for pg should be 8

C++ program to creake base class student (name,reg,age)and find average age,semester wise for ug %26amp;pg students?
its easy.take the help of concepts in textbook.


step:-1.class A


constructor A,extract 5 student details.


-select(),select the student pg/ug and also his b'day,1st/2nd/3rd/4th... semester.


2.-class B inherit classA


constructor B,select the sem in which student is at present...let ug age 20,nth semester,bday will be in mth semester...


- avg_age(),avg age 22 {for(i=1;i%26lt;=n;i++)then if(i%2==m%2)then age=age+1}we use 2 here as 2semester will be there in the year.


3.- now we use another class in which main function will be and the objects r created,funtions are called....


No comments:

Post a Comment