If the user enters 1, the program should be able to calculate the grade of N numbers of students. The program that will read data for test1 score and test2 score for all the students. The output should contain the score of test1 and test2 and the grade for the average score of test1 and test2 and also the number of students with grade F based on the Table as given below. Display the output.
Table : Grade Table / Jadual : Jadual Gred
Average Score Grade
80 – 100 A
65 – 79 B
50 – 64 C
35 – 49 D
0 - 34 F
If the user enters 2, the program should ask to enter one integer value from 1 to 12 and then display the following multiplication table:
Example :
If input : 7
The output that will be displayed :
Muliplication of 7
1 X 7 = 7
2 X 7 = 14
.
.
.
12 X 7 = 84
If the user enters 3, the program should be able to display the pyramid using asterisks(*), where the size is form by countable lines. User will enter the total line. Display the output.
Display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the main menu. If the user enters 4, the program should end.
main()
{
int credit_hours[10];
int sem,total_subject; //'b', 'a',total_credit_hours and total_point
//are removed
float value[10],gpa[10],get_point[10];
float cgpa;
float total_point_sem = 0; //Initialise value
int total_credit_hours_sem = 0; //Initialise value
cin.ignore();
cout << "\n ENTER STUDENT'S NAME : "; //Enter student's name
getline(cin,student1.name);
cout << " ENTER STUDENT'S MATRIC NUMBER : "; //Enter student's matric number
getline(cin,student1.no_matric);
cout << " ENTER TOTAL SEM TAKEN :"; //Total semester taken by the student
cin >> sem;
for(int a = 0; a< sem ; a++) //'a' declared as int in for()[newly added]
{
int b; //newly added line,'b' choose to add it here because, if not, error will be occured : 'b' for gpa[b] will become undefined...
int total_credit_hours = 0; //newly added
float total_point = 0; //newly added
cout << "\n ENTER SUBJECT TAKEN FOR SEM : " << a+1 << ":"; //Enter total number of subject taken for each sem
cin >> total_subject;
for(int b = 0; b< total_subject; b++) //loop for the courses
{
cin.ignore();
cout << " ENTER SUBJECT CODE : "; //Enter subject code
getline(cin,student1.sub_code[b]);
cout << " ENTER SUBJECT NAME : "; //Enter subject name
getline(cin,student1.sub_name[b]);
cout << " ENTER SUBJECT'S CREDIT HOUR : "; //Enter credit hours of the subject
cin >> student1.credit_hour[b];
cin.ignore();
cout << " ENTER SUBJECT GRED : "; //Enter grade gained by student for every subject
getline(cin,student1.sub_grade[b]);
get_point[b] = student1.credit_hour[b] * value[b]; //multiply of credit hours and grade get for each subject
total_credit_hours +=student1.credit_hour[b]; //total cerdit hours for a sem
total_point += get_point[b]; //total points(multiple of credits hours and grade)get for a sem
}
gpa[b] = total_point / total_credit_hours; //calculate GPA for each sem
total_point_sem += total_point; //Total points(multiple of grade and credit hours) get for all semester
total_credit_hours_sem += total_credit_hours; //credits hour get for all semester
}
84 35 [Error] no match for 'operator!=' (operand types are 'int' and 'std::vector<student>::iterator {aka __gnu_cxx::__normal_iterator<student*, std::vector<student> >}')
Lol man you gotta get a newer version of C++.
Just edited it again.
The C++ keyword "auto" also isn't supported in earlier versions of C++,
so I changed "auto" to "vector<student>::iterator"
i see so i need to update my dev c++ lol ,
alright it works perfectly now thanks man
i will play with it so ill understand it more lol
thank you so much man for the help , :)))
i really owe you man