C++ Project Un
C++ Project Un
DURAME CAMPUS
Department of computer science
project assignment of C++
program
NAME ID
NAOL DUGO 4822
Muluken fenta 4772
Tagese Girma 4915
Zubayda tadese 5107
#include <iostream>
#include <string>
#include <iomanip>
struct Marks {
float cpp;
float introToComputer;
float emergingTech;
float physics;
float english;
float fundamentalsOfDatabase;
};
struct Student {
string name;
string regNo;
char section; // A or B
};
while (true) {
} else {
cout << "Error: Invalid section. Please enter A or B." << endl;
cin.ignore();
getline(cin, s.name);
}
float calculateAverage(Marks m) {
void displayStudentData(Student s) {
cout << fixed << setprecision(2); // Set output precision for marks
cout << "| " << left << setw(20) << s.name
<< "| " << setw(5) << calculateAverage(s.marks) << " |" << endl;
if (count > 0) {
cout << "Section average: " << totalMarks / count << endl;
} else {
}
int main() {
int n;
cin >> n;
cout << "\nEnter data for student " << i + 1 << ":\n";
inputStudentData(students[i]);
if (students[i].section == 'A') {
sectionACount++;
sectionATotalMarks += calculateAverage(students[i].marks);
sectionBCount++;
sectionBTotalMarks += calculateAverage(students[i].marks);
cout << "| " << left << setw(20) << "Name"
<< "| " << left << setw(15) << "Registration No"
<< "| C++ | Intro to Comp | Emerging Tech | Physics | English | Database | Avg |" << endl;
displayStudentData(students[i]);
displaySectionAverage(sectionATotalMarks, sectionACount);
displaySectionAverage(sectionBTotalMarks, sectionBCount);
return 0;