gameover.blog.ir
#include <iostream>
using namespace std;
struct student{
char name[50];
int roll;
float marks;
};
int main(){
struct student s[10];
int i;
cout << "Enter information of students : " << endl;
for(i=0;i<10;++i)
{
s[i].roll=i+1;
cout << endl << "For roll number : " << s[i].roll << endl;
cout << "Enter name : ";
cin >> s[i].name;
cout << endl << "Enter marks : ";
cin >> s[i].marks;
cout << endl;
}
cout << "Displaying information of students : " << endl << endl;
for(i=0;i<10;++i)
{
cout << endl << "Information for roll number : " << i+1;
cout << endl << "Name : " << s[i].name;
cout << endl << "Marks : " << s[i].marks;
}
return 0;
}
Output
Enter information of students : For roll number : 1 Enter name : Tom Enter marks : 98 For roll number : 2 Enter name: Jerry Enter marks: 89 . . . Displaying information of students : Information for roll number 1 : Name : Tom Marks : 98 . . .