create a c++ code that will set first the number of the student to be entered then get the name and their grades, After that display the name, grades & remarks of the student using arrays
Certainly! I can help you with that. Here's an example of a C++ code that achieves what you described:
```cpp
#include <iostream>
using namespace std;
const int MAX_STUDENTS = 100;
int main() {
int numStudents;
cout << "Enter the number of students: ";
cin >> numStudents;
// Array to store student names
string names[MAX_STUDENTS];
// Array to store student grades
double grades[MAX_STUDENTS];
// Array to store student remarks
string remarks[MAX_STUDENTS];
// Get the name and grade for each student
for (int i = 0; i < numStudents; i++) {
cout << "Enter name for student " << i+1 << ": ";
cin >> names[i];
cout << "Enter grade for student " << i+1 << ": ";
cin >> grades[i];
// Determine the remarks based on the grade
if (grades[i] >= 90) {
remarks[i] = "Excellent";
} else if (grades[i] >= 80) {
remarks[i] = "Good";
} else if (grades[i] >= 70) {
remarks[i] = "Average";
} else if (grades[i] >= 60) {
remarks[i] = "Below Average";
} else {
remarks[i] = "Fail";
}
}
// Display the name, grades, and remarks for each student
cout << "Name\t\tGrade\t\tRemark" << endl;
for (int i = 0; i < numStudents; i++) {
cout << names[i] << "\t\t" << grades[i] << "\t\t" << remarks[i] << endl;
}
return 0;
}
```
In this code, we prompt the user to enter the number of students and store it in the `numStudents` variable. Then, we create three arrays: `names` to store the names of the students, `grades` to store their grades, and `remarks` to store their remarks.
We use a loop to get the name and grade for each student. After each grade input, we determine the corresponding remark based on the grade and store it in the `remarks` array.
Finally, we display the name, grade, and remark for each student using another loop.