Here's the C++ program that will be able to process results of students:
#include <iostream>
#include <string>
using namespace std;
int main() {
string candidates[10];
string courses[5] = {"Math", "Science", "English", "History", "Art"};
string course_codes[] = {"MAT", "SCI", "ENG", "HIS", "ART"};
int marks[10][5];
char grades[10][5];
// Request the user to enter names of 10 candidates and their respective marks in 5 courses for the semester
for (int i = 0; i < 10; i++) {
cout << "Enter name of candidate " << i+1 << ": ";
getline(cin, candidates[i]);
for (int j = 0; j < 5; j++) {
cout << "Enter marks for " << courses[j] << " (out of 100): ";
cin >> marks[i][j];
// Assign grades based on marks
if (marks[i][j] >= 90) {
grades[i][j] = 'A';
} else if (marks[i][j] >= 80) {
grades[i][j] = 'B';
} else if (marks[i][j] >= 70) {
grades[i][j] = 'C';
} else if (marks[i][j] >= 60) {
grades[i][j] = 'D';
} else {
grades[i][j] = 'F';
}
}
cout << endl;
cin.ignore(); // Ignore newline character from cin
}
// Display the names of the candidates, their respective course names, course code, marks and grade
cout << "Candidate\t";
for (int j = 0; j < 5; j++) {
cout << courses[j] << "\t";
}
cout << endl;
for (int i = 0; i < 10; i++) {
cout << candidates[i] << "\t\t";
for (int j = 0; j < 5; j++) {
cout << course_codes[j] << marks[i][j] << "(" << grades[i][j] << ")" << "\t";
}
cout << endl;
}
return 0;
}
Sample Output:
Enter name of candidate 1: John Doe
Enter marks for Math (out of 100): 90
Enter marks for Science (out of 100): 85
Enter marks for English (out of 100): 80
Enter marks for History (out of 100): 95
Enter marks for Art (out of 100): 90
Enter name of candidate 2: Jane Doe
Enter marks for Math (out of 100): 80
Enter marks for Science (out of 100): 85
Enter marks for English (out of 100): 70
Enter marks for History (out of 100): 75
Enter marks for Art (out of 100): 60
Enter name of candidate 3: Bob Smith
Enter marks for Math (out of 100): 60
Enter marks for Science (out of 100): 50
Enter marks for English (out of 100): 70
Enter marks for History (out of 100): 65
Enter marks for Art (out of 100): 80
Enter name of candidate 4: Alice Wilson
Enter marks for Math (out of 100): 95
Enter marks for Science (out of 100): 90
Enter marks for English (out of 100): 90
Enter marks for History (out of 100): 90
Enter marks for Art (out of 100): 95
Enter name of candidate 5: Tom Johnson
Enter marks for Math (out of 100): 80
Enter marks for Science (out of 100): 85
Enter marks for English (out of 100): 70
Enter marks for History (out of 100): 75
Enter marks for Art (out of 100): 60
Enter name of candidate 6: Mary Brown
Enter marks for Math (out of 100): 60
Enter marks for Science (out of 100): 65
Enter marks for English (out of 100): 75
Enter marks for History (out of 100): 70
Enter marks for Art (out of 100): 80
Enter name of candidate 7: Joe Thomas
Enter marks for Math (out of 100): 75
Enter marks for Science (out of 100): 80
Enter marks for English (out of 100): 65
Enter marks for History (out of 100): 70
Enter marks for Art (out of 100): 60
Enter name of candidate 8: Amy Johnson
Enter marks for Math (out of 100): 95
Enter marks for Science (out of 100): 90
Enter marks for English (out of 100): 90
Enter marks for History (out of 100): 90
Enter marks for Art (out of 100): 95
Enter name of candidate 9: Bob Brown
Enter marks for Math (out of 100): 60
Enter marks for Science (out of 100): 65
Enter marks for English (out of 100): 75
Enter marks for History (out of 100): 70
Enter marks for Art (out of 100): 80
Enter name of candidate 10: Sarah Lee
Enter marks for Math (out of 100): 70
Enter marks for Science (out of 100): 75
Enter marks for English (out of 100): 60
Enter marks for History (out of 100): 55
Enter marks for Art (out of 100): 50
Candidate Math Science English History Art
John Doe MAT90(A) SCI85(B) ENG80(B) HIS95(A) ART90(A)
Jane Doe MAT80(B) SCI85(B) ENG70(C) HIS75(C) ART60(D)
Bob Smith MAT60(D) SCI50(F) ENG70(C) HIS65(D) ART80(B)
Alice Wilson MAT95(A) SCI90(A) ENG90(A) HIS90(A) ART95(A)
Tom Johnson MAT80(B) SCI85(B) ENG70(C) HIS75(C) ART60(D)
Mary Brown MAT60(D) SCI65(D) ENG75(C) HIS70(C) ART80(B)
Joe Thomas MAT75(C) SCI80(B) ENG65(D) HIS70(C) ART60(D)
Amy Johnson MAT95(A) SCI90(A) ENG90(A) HIS90(A) ART95(A)
Bob Brown MAT60(D) SCI65(D) ENG75(C) HIS70(C) ART80(B)
Sarah Lee MAT70(C) SCI75(C) ENG60(D) HIS55(F) ART50(F)