c 2b 2b how to create a program that stores details

Solutions on MaxInterview for c 2b 2b how to create a program that stores details by the best coders in the world

showing results for - "c 2b 2b how to create a program that stores details"
Emely
15 Feb 2017
1#include <iostream>
2using namespace std;
3
4struct student
5{
6    char name[50];
7    int roll;
8    float marks;
9} s[10];
10
11int main()
12{
13    cout << "Enter information of students: " << endl;
14
15    // storing information
16    for(int i = 0; i < 10; ++i)
17    {
18        s[i].roll = i+1;
19        cout << "For roll number" << s[i].roll << "," << endl;
20
21        cout << "Enter name: ";
22        cin >> s[i].name;
23
24        cout << "Enter marks: ";
25        cin >> s[i].marks;
26
27        cout << endl;
28    }
29
30    cout << "Displaying Information: " << endl;
31
32    // Displaying information
33    for(int i = 0; i < 10; ++i)
34    {
35        cout << "\nRoll number: " << i+1 << endl;
36        cout << "Name: " << s[i].name << endl;
37        cout << "Marks: " << s[i].marks << endl;
38    }
39
40    return 0;
41}
42
43
similar questions