-
Notifications
You must be signed in to change notification settings - Fork 380
/
Copy pathstudentstructure.cpp
55 lines (44 loc) · 1.14 KB
/
studentstructure.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;
struct student
{
char name[50];
int roll;
float marks1;
float marks2;
float marks3;
} s[5];
int main()
{
int x;
cout << "Enter information of students: " << endl;
// storing information
for(int i = 0; i < 5; ++i)
{
cout << "For roll number" <<endl;
cin>>s[i].roll ;
cout << "Enter name: ";
cin >> s[i].name;
cout << "Enter marks1: ";
cin >> s[i].marks1;
cout << "Enter marks2: ";
cin >> s[i].marks2;
cout << "Enter marks3: ";
cin >> s[i].marks3;
cout << endl;
}
cout << "Displaying Information: " << endl;
// Displaying information
for(int i = 0; i < 5; ++i)
{
x=(s[i].marks1+s[i].marks2+s[i].marks3);
cout << "\nRoll number: " << s[i].roll << endl;
cout << "Name: " << s[i].name << endl;
cout << "Marks1: " << s[i].marks1 << endl;
cout << "Marks2: " << s[i].marks2 << endl;
cout << "Marks3: " << s[i].marks3 << endl;
cout <<"total marks:"<<x<<endl;
cout<<"percentage:"<<x/3<<endl;
}
return 0;
}