#include <iostream>
using namespace std;
class student
{
int roll;
char name[15];
int marks[5];
public:
void input();
void display();
};
void student :: input()
{
cout<<"please enter your name ";
cin>>name;
cout<<endl<<"now enter your roll no";
cin>>roll;
cout<<endl<<"now enter your marks"<<endl;
for(int i=0;i<5;i++)
{
cin>>marks[i];
}
}
void student :: display()
{
cout<<"\n name "<<name<<endl;
cout<<"\n roll no "<<roll<<endl;
cout<<"\n marks \n --------------------------------------------- "<<endl;
for(int i=0;i<5;i++)
{
cout<<marks[i]<<" ";
}
cout<<" \n -------------------------------------------- \n";
}
int main()
{
student s[5];
cout<<"enter student record \n";
cout<<"----------------------------------- \n";
for(int i=0;i<5;i++)
{
s[i].input();
}
for(int i=0;i<5;i++)
{
s[i].display();
}
return 0;
}
using namespace std;
class student
{
int roll;
char name[15];
int marks[5];
public:
void input();
void display();
};
void student :: input()
{
cout<<"please enter your name ";
cin>>name;
cout<<endl<<"now enter your roll no";
cin>>roll;
cout<<endl<<"now enter your marks"<<endl;
for(int i=0;i<5;i++)
{
cin>>marks[i];
}
}
void student :: display()
{
cout<<"\n name "<<name<<endl;
cout<<"\n roll no "<<roll<<endl;
cout<<"\n marks \n --------------------------------------------- "<<endl;
for(int i=0;i<5;i++)
{
cout<<marks[i]<<" ";
}
cout<<" \n -------------------------------------------- \n";
}
int main()
{
student s[5];
cout<<"enter student record \n";
cout<<"----------------------------------- \n";
for(int i=0;i<5;i++)
{
s[i].input();
}
for(int i=0;i<5;i++)
{
s[i].display();
}
return 0;
}
No comments:
Post a Comment