Tuesday, July 12, 2011

average.cp

#include


class gobi2

{
public:

int coa,c,asp,total,avg1;

void add();

void avg();
};

void main()
{
gobi2 g2;

clrscr();
g2.add();

g2.avg();

getch();

}
void gobi2::add()
{
cout<<"enter the value of coa\n";

cin>>coa;

cout<<"enter the value of c\n";

cin>>c;

cout<<"enter the value of asp\n";

cin>>asp;

total=coa+asp+c;

}

void gobi2::avg()

{
avg1=total/3;

cout<<"the avarage of 3 subjects are:"<output:

enter the value of coa


35


enter the value of c

78


enter the value of asp

87

the avarage of 3 subjects are:66



No comments:

Post a Comment