Write a program using structure to calculate CGPA of student.assume there are 20 courses each having either 3 or 4 credit hours.take the name of students,name of course,credit hours,grade,GPA from user and print a transcript containing student name ,course name,grade,credit hours and gpa.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string surname,name,grade,GPA;
int course,hours;
cout <<"---_CGPA of student_---
";
cout <<"-Enter student's name-:
";
cin >> name;
cout <<"-Enter student's surname-:
";
cin >> surname;
cout <<"-Enter the name of course-:
";
cin >> course;
while ( course >0 && course >21 )
{
cout <<"-Enter the name of course(1 to 20)-:
";
cin>> course;
}
cout <<"-Enter the credit hours-:
";
cin >> hours;
while ( hours!=3 && hours!=4 )
{
cout <<"-Enter the credit hours (3 or 4)-:
";
cin >> hours;
}
cout <<"-Enter the grade-:
";
cin>> grade;
cout <<"-Enter the GPA-:
";
cin>> GPA;
cout <<"
------Transcript------
";
cout << name << " " << surname <<"
";
cout << "Course " << course <<"
";
cout << "Hours " << hours <<"
";
cout << "Grade " << grade <<"
";
cout << "GPA " << GPA <<"
";
return 0;
}