-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7_5.cpp
More file actions
51 lines (40 loc) · 1.34 KB
/
7_5.cpp
File metadata and controls
51 lines (40 loc) · 1.34 KB
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>
#include <iomanip>
#include <string>
using namespace std;
// Function to return a user-defined manipulator for currency formatting
ostream& currency(ostream& os) {
os << "rupees ";
return os;
}
// Structure to store student data
struct Student {
string name;
float marks;
float tuitionFee;
};
// Function to display a formatted table of students
void displayStudents(Student students[], int count) {
cout << "\n======= Student Academic Report =======\n";
cout << left << setw(20) << "Name"
<< setw(10) << "Marks"
<< setw(15) << "Tuition Fee" << endl;
cout << string(45, '-') << endl;
for (int i = 0; i < count; ++i) {
cout << left << setw(20) << students[i].name
<< setw(10) << fixed << setprecision(2) << students[i].marks
<< currency << setw(14) << fixed << setprecision(2) << students[i].tuitionFee << endl;
}
}
int main() {
// Updated data: name, marks, tuition fee
Student students[] = {
{"Pushti", 90.5f, 49000.00f},
{"Reeva", 91.0f, 47500.50f},
{"Khushi", 90.25f, 44000.75f},
};
int studentCount = sizeof(students) / sizeof(students[0]);
displayStudents(students, studentCount);
cout<<endl<<"24CE052_PushtiKansara"<<endl;
return 0;
}