-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure.cpp
More file actions
51 lines (48 loc) · 953 Bytes
/
structure.cpp
File metadata and controls
51 lines (48 loc) · 953 Bytes
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
#include <iostream>
using namespace std;
struct student
{
int rollNo;
int marks;
float percentage;
char grade;
};
int main()
{
student fras;
cout << "Enter Roll no: ";
cin >> fras.rollNo;
cout << "Enter Marks: ";
cin >> fras.marks;
cout << "Enter Percentage: ";
cin >> fras.percentage;
if (fras.percentage >= 85)
{
fras.grade = 'A';
}
else if (fras.percentage >= 80)
{
fras.grade = 'B';
}
else if (fras.percentage >= 70)
{
fras.grade = 'C';
}
else if (fras.percentage >= 60)
{
fras.grade = 'D';
}
else if (fras.percentage >= 50)
{
fras.grade = 'E';
}
else
{
fras.grade = 'F';
}
cout << "Roll No: " << fras.rollNo << endl;
cout << "Marks: " << fras.marks << endl;
cout << "Percentage: " << fras.percentage << endl;
cout << "Grade: " << fras.grade << endl;
return 0;
}