Sunday, July 4, 2010

STUDENT DETAILS

Buzz It
/*PROGRAM TO READ AND DISPLAY STUDENT DETAILS
USING CLASSES */


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class student
{
int rollno,i;
char name[20];
float mark[6],total,avg;
public:
void read();
void calc();
void result();
};
void student::read()
{
cout<<"enter the roll no\t";
cin>>rollno;
cout<<"enter the name\t";
cin>>name;
cout<<"enter the mark in 6 subject\n";
for(i=0;i<6;i++)
cin>>mark[i];
}
void student::calc()
{ total=0;
for(i=0;i<6;i++)
total=total+mark[i];
avg=total/6;
}
void student::result()
{
cout<<"\nroll no is\t"<<rollno;
cout<<"\nname is\t"<<name;
for(i=0;i<6;i++)
{
cout<<"\nmark in\t"<<i+1<<"subject:";
cout<<mark[i]<<"\n";
}
cout<<"\ntotal is:"<<total;
cout<<"\n average is:"<<avg;
}
void main()
{
clrscr();
char choice;
student st;
do
{
cout<<"\nenter the information of the student\n";
st.read();
cout<<"\nINFORMARTION:";
st.calc();
st.result();
cout<<"\ndo u want to continue or not(Y or N)\n";
cin>>choice;
}
while(choice=='Y'choice=='y');
getch();
}


OUTPUT:
enter the information of the student
enter the roll no 264
enter the name Anoop
enter the mark in 6 subject
45
40
42
38
60
55
INFORMARTION:
roll no is 264
name is Anoop
mark in 1 subject:45
mark in 2 subject:40
mark in 3 subject:42
mark in 4 subject:38
mark in 5 subject:60
mark in 6 subject:55
total is: 280
average is:46.666668
do u want to continue or not(Y or N)
N

0 comments:

Post a Comment