#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;

int main ()
{
	int semester;
	string grade1,grade2,grade3,grade4,grade5,grade6,grade7,grade8,grade9,grade10,grade11,grade12,grade13,grade14,grade15,grade16,grade17,grade18,name,matric,ic,section;
	string grade19,grade20,grade21,grade22,grade23,grade24,grade25,grade26,grade27,grade28,grade29,grade30,grade31;
	double pointer1,pointer2,pointer3,pointer4,pointer5,pointer6,pointer7,pointer8,pointer9,pointer10,pointer11,pointer12,pointer13,pointer14,pointer15,pointer16,pointer17,pointer18;
	double pointer19,pointer20,pointer21,pointer22,pointer23,pointer24,pointer25,pointer26,pointer27,pointer28,pointer29,pointer30,pointer31;
	double GPA1,GPA2,GPA3,GPA4,GPA5,GPA6,GPA7,GPA8,GPA9,GPA10,GPA11,GPA12,GPA13,GPA14,GPA15,GPA16,GPA17,GPA18,CGPA1,CGPA2,CGPA3,CGPA4;
	double GPA19,GPA20,GPA21,GPA22,GPA23,GPA24,GPA25,GPA26,GPA27,GPA28,GPA29,GPA30,GPA31,CGPA5,CGPA6,CGPA7,CGPA8;
	ofstream outFile;
	char ans;
	
	

	cout << endl << "Hello ! Welcome to UTM Foundation CGPA System !\n";
	cout << endl << "Please fulfill your personal info first\n";
	cout << endl << "Please key in your name : ";
	cin.ignore();
	getline(cin,name);
	cout  << "Please key in your identity card number : ";
	cin.ignore();
	getline(cin,ic);
	cout << "Please key in your matric number : ";
	cin.ignore();
	getline(cin, matric);
	cout << "Please key in your section : ";
	cin.ignore();
	getline(cin, section);
	
	
	cout << endl << "******Semester List*******";
	cout << endl << "1: Semester II Session 2020/2021";
	cout << endl << "2: Semester III Session 2020/2021";
	cout << endl << "3: Semester I Session 2021/2022";
	cout << endl << "4: All Semester";
	cout << endl << "5. Main Subject";
	cout << endl << endl << "Kindly select the semester that you want to check : ";
	cin >> semester;
	
	
	if(semester==1){
		cout << endl << "You are choosing Semester II Session 2020/2021";
		cout << endl << "Course that you conducting during Semester II are ";
		cout << endl << "1. Philosophy of Science and Technology";
		cout << endl << "2. Cocuriculum: Entreneurship";
		cout << endl << "3. General English";
		cout << endl << "4. Physics I";
		cout << endl << "5. Chemistry I";
		cout << endl << "6. Computer Literacy";
		cout << endl << "7. Intermediate Mathematics";
		
		cout << endl << endl << endl << "Now kindly key in your details for your results to calculate your CGPA";
		cout << endl << endl << "1. Philosophy of Science and Technology: ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade1);
		cout << "Pointer: ";
		cin >> pointer1;
		
		GPA1= pointer1*2;
		
		cout << endl << endl << "2. Cocuriculum: Entreneurship : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade2);
		cout << "Pointer: ";
		cin >> pointer2;
		
		GPA2= pointer2*2;
		
		cout << endl << endl << "3. General English : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade3);
		cout << "Pointer: ";
		cin >> pointer3;
		
		GPA3= pointer3*2;
		
		cout << endl << endl << "4. Physics I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade4);
		cout << "Pointer: ";
		cin >> pointer4;
		
		GPA4= pointer4*4;
		
		cout << endl << endl << "5. Chemistry I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade5);
		cout << "Pointer: ";
		cin >> pointer5;
		
		GPA5= pointer5*4;
		
		cout << endl << endl << "6. Computer Literacy : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade6);
		cout << "Pointer: ";
		cin >> pointer6;
		
		GPA6= pointer6*2;
		
		cout << endl << endl << "7. Intermediate Mathematics : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade7);
		cout << "Pointer: ";
		cin >> pointer7;
		
		GPA7= pointer7*4;
		
		CGPA1=(GPA1+GPA2+GPA3+GPA4+GPA5+GPA6+GPA7)/20;
		
		cout << endl << "Please wait ! Your CGPA slip is generating now !";
		
		outFile.open("CGPA Semester II.txt");
		
		outFile << "CGPA Slip";
		outFile << endl << "Semester : Semester II";
		outFile << endl << "Session : Session 2020/2021";
		outFile << endl << endl << "Student Info";
		
		outFile << endl << "Student Name : " << name;
		outFile << endl << "Student Identity Card Number : " << ic;
		outFile << endl << "Student Matric Number : " << matric;
		outFile << endl << "Student Section : " << section;
		
		outFile << endl << endl << "Student Results\n";
		outFile << "************************************\n";
		
		outFile << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Philosophy of Science and Technology" << setw(20) << "2" << setw(10) << grade1 << setw(10) << fixed << setprecision(2) << pointer1 << setw(10) << fixed << setprecision(2) << GPA1;
		outFile << endl << left << setw(50) << "Cocuriculum : Entreneurship" << setw(20) << "2" << setw(10) << grade2 << setw(10) << fixed << setprecision(2) << pointer2 << setw(10) << fixed << setprecision(2) << GPA2;
		outFile << endl << left << setw(50) << "General English" << setw(20) << "2" << setw(10) << grade3 << setw(10) << fixed << setprecision(2) << pointer3 << setw(10) << fixed << setprecision(2) << GPA3;
		outFile << endl << left << setw(50) << "Physics I" << setw(20) << "4" << setw(10) << grade4 << setw(10) << fixed << setprecision(2) << pointer4 << setw(10) << fixed << setprecision(2) << GPA4;
		outFile << endl << left << setw(50) << "Chemistry I" << setw(20) << "4" << setw(10) << grade5 << setw(10) << fixed << setprecision(2) << pointer5 << setw(10) << fixed << setprecision(2) << GPA5;
		outFile << endl << left << setw(50) << "Computer Literacy"  << setw(20) << "2" << setw(10) << grade6 << setw(10) << fixed << setprecision(2) << pointer6 << setw(10) << fixed << setprecision(2) << GPA6;
		outFile << endl << left << setw(50) << "Intermediate Mathematics" << setw(20) << "4" << setw(10) << grade7 << setw(10) << fixed << setprecision(2) << pointer7 << setw(10) << fixed << setprecision(2) << GPA7;
		
		outFile << endl << endl << "Your GPA for Semester II Session 2020/2021 is " << fixed << setprecision(2) << CGPA1;
		
		outFile << endl << endl << "Hope you can work harder to fight for higher CGPA or maintain your CGPA !";
		
		outFile.close();
		
		cout << endl << "Your CGPA list is done generate ! Check it at your file saving location !";
		cout << endl << "See you again~ Bye~";
	}
	
	else if(semester==2){
		cout << endl << "You are choosing Semester III Session 2020/2021";
		cout << endl << "Course that you conducting during Semester III are ";
		cout << endl << "1. Physics II";
		cout << endl << "2. Physics Practical I";
		cout << endl << "3. Chemistry II";
		cout << endl << "4. Chemistry Practical I";
		cout << endl << "5. Academic Listenning and Speaking Skills";
		cout << endl << "6. Fundamental of Computing";
		cout << endl << "7. Calculus";
		
		cout << endl << endl << endl << "Now kindly key in your details for your results to calculate your CGPA";
		cout << endl << endl << "1. Physics II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade8);
		cout << "Pointer: ";
		cin >> pointer8;
		
		GPA8= pointer8*4;
		
		cout << endl << endl << "2. Physics Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade9);
		cout << "Pointer: ";
		cin >> pointer9;
		
		GPA9= pointer9*2;
		
		cout << endl << endl << "3. Chemistry II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade10);
		cout << "Pointer: ";
		cin >> pointer10;
		
		GPA10= pointer10*4;
		
		cout << endl << endl << "4. Chemistry Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade11);
		cout << "Pointer: ";
		cin >> pointer11;
		
		GPA11= pointer11*2;
		
		cout << endl << endl << "5. Academic Listenning and Reading Skills : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade12);
		cout << "Pointer: ";
		cin >> pointer12;
		
		GPA12= pointer12*2;
		
		cout << endl << endl << "6. Fundamentals of Computing : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade13);
		cout << "Pointer: ";
		cin >> pointer13;
		
		GPA13= pointer13*2;
		
		cout << endl << endl << "7. Calculus : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade14);
		cout << "Pointer: ";
		cin >> pointer14;
		
		GPA14= pointer14*4;
		
		CGPA2=(GPA8+GPA9+GPA10+GPA11+GPA12+GPA13+GPA14)/20;
		
		cout << endl << "Please wait ! Your CGPA slip is generating now !";
		
		outFile.open("CGPA Semester III.txt");
		
		outFile << "CGPA Slip";
		outFile << endl << "Semester : Semester III";
		outFile << endl << "Session : Session 2020/2021";
		outFile << endl << endl << "Student Info";
		
		outFile << endl << "Student Name : " << name;
		outFile << endl << "Student Identity Card Number : " << ic;
		outFile << endl << "Student Matric Number : " << matric;
		outFile << endl << "Student Section : " << section;
		
		outFile << endl << endl << "Student Results\n";
		outFile << "************************************\n";
		
		outFile << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Physics II" << setw(20) << "4" << setw(10) << grade8 << setw(10) << fixed << setprecision(2) << pointer8 << setw(10) << fixed << setprecision(2) << GPA8;
		outFile << endl << left << setw(50) << "Physics Practical I" << setw(20) << "2" << setw(10) << grade9 << setw(10) << fixed << setprecision(2) << pointer9 << setw(10) << fixed << setprecision(2) << GPA9;
		outFile << endl << left << setw(50) << "Chemistry II" << setw(20) << "4" << setw(10) << grade10 << setw(10) << fixed << setprecision(2) << pointer10 << setw(10) << fixed << setprecision(2) << GPA10;
		outFile << endl << left << setw(50) << "Chemsitry Practical I" << setw(20) << "2" << setw(10) << grade11 << setw(10) << fixed << setprecision(2) << pointer11 << setw(10) << fixed << setprecision(2) << GPA11;
		outFile << endl << left << setw(50) << "Academic Listenning and Speaking" << setw(20) << "2" << setw(10) << grade12 << setw(10) << fixed << setprecision(2) << pointer12 << setw(10) << fixed << setprecision(2) << GPA12;
		outFile << endl << left << setw(50) << "Fundamentals of Computing" << setw(20) << "2" << setw(10) << grade13 << setw(10) << fixed << setprecision(2) << pointer13 << setw(10) << fixed << setprecision(2) << GPA13;
		outFile << endl << left << setw(50) << "Calculus" << setw(20) << "4" << setw(10) << grade14 << setw(10) << fixed << setprecision(2) << pointer14 << setw(10) << fixed << setprecision(2) << GPA14;
		
		outFile << endl << endl << "Your GPA for Semester III Session 2020/2021 is " << fixed << setprecision(2) << CGPA2;
		
		outFile << endl << endl << "Hope you can work harder to fight for higher CGPA or maintain your CGPA !";
		
		outFile.close();
		
		cout << endl << "Your CGPA list is done generate ! Check it at your file saving location !";
		cout << endl << "See you again~ Bye~";
		
	}
	
	else if(semester==3){
		cout << endl << "You are choosing Semester I Session 2021/2022";
		cout << endl << "Course that you conducting during Semester I is ";
		cout << endl << "1. Physics Practical II";
		cout << endl << "2. Chemistry Practical II";
		cout << endl << "3. Academic Writing and Reading Skills";
		cout << endl << "4. Statistics and Probability";

		
		cout << endl << endl << endl << "Now kindly key in your details for your results to calculate your CGPA";
		cout << endl << endl << "1. Physics Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade8);
		cout << "Pointer: ";
		cin >> pointer15;
		
		GPA15= pointer15*2;
		
		cout << endl << endl << "2. Chemistry Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade16);
		cout << "Pointer: ";
		cin >> pointer16;
		
		GPA16= pointer16*2;
		
		cout << endl << endl << "3. Academic Writing and Reading Skills : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade17);
		cout << "Pointer: ";
		cin >> pointer17;
		
		GPA17= pointer17*2;
		
		cout << endl << endl << "4. Statistics and Probability : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade18);
		cout << "Pointer: ";
		cin >> pointer18;
		
		GPA18= pointer18*4;
		
		CGPA3=(GPA15+GPA16+GPA17+GPA18)/10;
	
		cout << endl << "Please wait ! Your CGPA slip is generating now !";
		
		outFile.open("CGPA Semester I.txt");
		
		outFile << "CGPA Slip";
		outFile << endl << "Semester : Semester I";
		outFile << endl << "Session : Session 2021/2022";
		outFile << endl << endl << "Student Info";
		
		outFile << endl << "Student Name : " << name;
		outFile << endl << "Student Identity Card Number : " << ic;
		outFile << endl << "Student Matric Number : " << matric;
		outFile << endl << "Student Section : " << section;
		
		outFile << endl << endl << "Student Results\n";
		outFile << "************************************\n";
		
		outFile << left << setw(50) << "Subject" <<setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Physics Practical II" << setw(20) << "2" << setw(10) << grade15 << setw(10) << fixed << setprecision(2) << pointer15 << setw(10) << fixed << setprecision(2) << GPA15;
		outFile << endl << left << setw(50) << "Chemistry Practical II" << setw(20) << "2" << setw(10) << grade16 << setw(10) << fixed << setprecision(2) << pointer16 << setw(10) << fixed << setprecision(2) << GPA16;
		outFile << endl << left << setw(50) << "Academic Writing and Reading Skills" << setw(20) << "2" << setw(10) << grade17 << setw(10) << fixed << setprecision(2) << pointer17 << setw(10) << fixed << setprecision(2) << GPA17;
		outFile << endl << left << setw(50) << "Statistics and Probability" << setw(20) << "4" << setw(10) << grade18 << setw(10) << fixed << setprecision(2) << pointer18 << setw(10) << fixed << setprecision(2) << GPA18;
		
		
		outFile << endl << endl << "Your GPA for Semester I Session 2021/2022 is " << fixed << setprecision(2) << CGPA3;
		
		outFile << endl << endl << "Hope you can work harder to fight for higher CGPA or maintain your CGPA !";
		
		outFile.close();
		
		cout << endl << "Your CGPA list is done generate ! Check it at your file saving location !";
		cout << endl << "See you again~ Bye~";
	}
	
	else if(semester==4){
		cout << endl << "You are choosing ALL SEMESTER in your Foundation Journey !";
		cout << endl << "Course that you conducting during Foundation Journey are ";
		cout << endl << "1. Philosophy of Science and Technology";
		cout << endl << "2. Cocuriculum: Entreneurship";
		cout << endl << "3. General English";
		cout << endl << "4. Physics I";
		cout << endl << "5. Chemistry I";
		cout << endl << "6. Computer Literacy";
		cout << endl << "7. Intermediate Mathematics";
		cout << endl << "8. Physics II";
		cout << endl << "9. Physics Practical I";
		cout << endl << "10. Chemistry II";
		cout << endl << "11. Chemistry Practical I";
		cout << endl << "12. Academic Listenning and Speaking Skills";
		cout << endl << "13. Fundamental of Computing";
		cout << endl << "14. Calculus";
		cout << endl << "15. Physics Practical II";
		cout << endl << "16. Chemistry Practical II";
		cout << endl << "17. Academic Writing and Reading Skills";
		cout << endl << "18. Statistics and Probability";
		
		cout << endl << endl << endl << "Now kindly key in your details for your results to calculate your CGPA";
		cout << endl << endl << "1. Philosophy of Science and Technology: ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade1);
		cout << "Pointer: ";
		cin >> pointer1;
		
		GPA1= pointer1*2;
		
		cout << endl << endl << "2. Cocuriculum: Entreneurship : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade2);
		cout << "Pointer: ";
		cin >> pointer2;
		
		GPA2= pointer2*2;
		
		cout << endl << endl << "3. General English : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade3);
		cout << "Pointer: ";
		cin >> pointer3;
		
		GPA3= pointer3*2;
		
		cout << endl << endl << "4. Physics I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade4);
		cout << "Pointer: ";
		cin >> pointer4;
		
		GPA4= pointer4*4;
		
		cout << endl << endl << "5. Chemistry I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade5);
		cout << "Pointer: ";
		cin >> pointer5;
		
		GPA5= pointer5*4;
		
		cout << endl << endl << "6. Computer Literacy : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade6);
		cout << "Pointer: ";
		cin >> pointer6;
		
		GPA6= pointer6*2;
		
		cout << endl << endl << "7. Intermediate Mathematics : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade7);
		cout << "Pointer: ";
		cin >> pointer7;
		
		GPA7= pointer7*4;
		
		cout << endl << endl << "8. Physics II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade8);
		cout << "Pointer: ";
		cin >> pointer8;
		
		GPA8= pointer8*4;
		
		cout << endl << endl << "9. Physics Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade9);
		cout << "Pointer: ";
		cin >> pointer9;
		
		GPA9= pointer9*2;
		
		cout << endl << endl << "10. Chemistry II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade10);
		cout << "Pointer: ";
		cin >> pointer10;
		
		GPA10= pointer10*4;
		
		cout << endl << endl << "11. Chemistry Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade11);
		cout << "Pointer: ";
		cin >> pointer11;
		
		GPA11= pointer11*2;
		
		cout << endl << endl << "12. Academic Listenning and Reading Skills : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade12);
		cout << "Pointer: ";
		cin >> pointer12;
		
		GPA12= pointer12*2;
		
		cout << endl << endl << "13. Fundamentals of Computing : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade13);
		cout << "Pointer: ";
		cin >> pointer13;
		
		GPA13= pointer13*2;
		
		cout << endl << endl << "14. Calculus : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade14);
		cout << "Pointer: ";
		cin >> pointer14;
		
		GPA14= pointer14*4;
		
		cout << endl << endl << "15. Physics Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade15);
		cout << "Pointer: ";
		cin >> pointer15;
		
		GPA15= pointer15*2;
		
		cout << endl << endl << "16. Chemistry Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade16);
		cout << "Pointer: ";
		cin >> pointer16;
		
		GPA16= pointer16*2;
		
		cout << endl << endl << "17. Academic Writing and Reading Skills : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade17);
		cout << "Pointer: ";
		cin >> pointer17;
		
		GPA17= pointer17*2;
		
		cout << endl << endl << "18. Statistics and Probability : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade18);
		cout << "Pointer: ";
		cin >> pointer18;
		
		GPA18= pointer18*4;
		
		CGPA1=(GPA1+GPA2+GPA3+GPA4+GPA5+GPA6+GPA7)/20;
		CGPA2=(GPA8+GPA9+GPA10+GPA11+GPA12+GPA13+GPA14)/20;
		CGPA3=(GPA15+GPA16+GPA17+GPA18)/10;
		CGPA4=(GPA1+GPA2+GPA3+GPA4+GPA5+GPA6+GPA7+GPA8+GPA9+GPA10+GPA11+GPA12+GPA13+GPA14+GPA15+GPA16+GPA17+GPA18)/50;
		
		cout << endl << "Please wait ! Your CGPA slip is generating now !";
		
		outFile.open("CGPA All Semester.txt");
		
		outFile << "CGPA Slip";
		outFile << endl << "Semester : All";
		outFile << endl << "Session : Session 2020/2021 & Session 2021/2022";
		outFile << endl << endl << "Student Info";
		
		outFile << endl << "Student Name : " << name;
		outFile << endl << "Student Identity Card Number : " << ic;
		outFile << endl << "Student Matric Number : " << matric;
		outFile << endl << "Student Section : " << section;
		
		outFile << endl << endl << "Student Results\n";
		outFile << "************************************\n";
		
		outFile << endl << "Semester II Session 2020/2021\n";
		outFile << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Philosophy of Science and Technology" << setw(20) << "2" << setw(10) << grade1 << setw(10) << fixed << setprecision(2) << pointer1 << setw(10) << fixed << setprecision(2) << GPA1;
		outFile << endl << left << setw(50) << "Cocuriculum : Entreneurship" << setw(20) << "2" << setw(10) << grade2 << setw(10) << fixed << setprecision(2) << pointer2 << setw(10) << fixed << setprecision(2) << GPA2;
		outFile << endl << left << setw(50) << "General English" << setw(20) << "2" << setw(10) << grade3 << setw(10) << fixed << setprecision(2) << pointer3 << setw(10) << fixed << setprecision(2) << GPA3;
		outFile << endl << left << setw(50) << "Physics I" << setw(20) << "4" << setw(10) << grade4 << setw(10) << fixed << setprecision(2) << pointer4 << setw(10) << fixed << setprecision(2) << GPA4;
		outFile << endl << left << setw(50) << "Chemistry I" << setw(20) << "4" << setw(10) << grade5 << setw(10) << fixed << setprecision(2) << pointer5 << setw(10) << fixed << setprecision(2) << GPA5;
		outFile << endl << left << setw(50) << "Computer Literacy"  << setw(20) << "2" << setw(10) << grade6 << setw(10) << fixed << setprecision(2) << pointer6 << setw(10) << fixed << setprecision(2) << GPA6;
		outFile << endl << left << setw(50) << "Intermediate Mathematics" << setw(20) << "4" << setw(10) << grade7 << setw(10) << fixed << setprecision(2) << pointer7 << setw(10) << fixed << setprecision(2) << GPA7;
		
		outFile << endl << endl << "Your GPA for Semester II Session 2020/2021 is " << fixed << setprecision(2) << CGPA1;
		
		outFile << endl << endl << "Semester III Session 2020/2021\n";		
		outFile << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Physics II" << setw(20) << "4" << setw(10) << grade8 << setw(10) << fixed << setprecision(2) << pointer8 << setw(10) << fixed << setprecision(2) << GPA8;
		outFile << endl << left << setw(50) << "Physics Practical I" << setw(20) << "2" << setw(10) << grade9 << setw(10) << fixed << setprecision(2) << pointer9 << setw(10) << fixed << setprecision(2) << GPA9;
		outFile << endl << left << setw(50) << "Chemistry II" << setw(20) << "4" << setw(10) << grade10 << setw(10) << fixed << setprecision(2) << pointer10 << setw(10) << fixed << setprecision(2) << GPA10;
		outFile << endl << left << setw(50) << "Chemsitry Practical I" << setw(20) << "2" << setw(10) << grade11 << setw(10) << fixed << setprecision(2) << pointer11 << setw(10) << fixed << setprecision(2) << GPA11;
		outFile << endl << left << setw(50) << "Academic Listenning and Speaking" << setw(20) << "2" << setw(10) << grade12 << setw(10) << fixed << setprecision(2) << pointer12 << setw(10) << fixed << setprecision(2) << GPA12;
		outFile << endl << left << setw(50) << "Fundamentals of Computing" << setw(20) << "2" << setw(10) << grade13 << setw(10) << fixed << setprecision(2) << pointer13 << setw(10) << fixed << setprecision(2) << GPA13;
		outFile << endl << left << setw(50) << "Calculus" << setw(20) << "4" << setw(10) << grade14 << setw(10) << fixed << setprecision(2) << pointer14 << setw(10) << fixed << setprecision(2) << GPA14;
		
		outFile << endl << endl << "Your GPA for Semester III Session 2020/2021 is " << fixed << setprecision(2) << CGPA2;
		
		outFile << endl << endl << "Semester I Session 2021/2022\n";
		outFile << left << setw(50) << "Subject" <<setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Physics Practical II" << setw(20) << "2" << setw(10) << grade15 << setw(10) << fixed << setprecision(2) << pointer15 << setw(10) << fixed << setprecision(2) << GPA15;
		outFile << endl << left << setw(50) << "Chemistry Practical II" << setw(20) << "2" << setw(10) << grade16 << setw(10) << fixed << setprecision(2) << pointer16 << setw(10) << fixed << setprecision(2) << GPA16;
		outFile << endl << left << setw(50) << "Academic Writing and Reading Skills" << setw(20) << "2" << setw(10) << grade17 << setw(10) << fixed << setprecision(2) << pointer17 << setw(10) << fixed << setprecision(2) << GPA17;
		outFile << endl << left << setw(50) << "Statistics and Probability" << setw(20) << "4" << setw(10) << grade18 << setw(10) << fixed << setprecision(2) << pointer18 << setw(10) << fixed << setprecision(2) << GPA18;
		
		outFile << endl << endl << "Your GPA for Semester I Session 2021/2022 is " << fixed << setprecision(2) << CGPA3;
		
		outFile << endl << endl << endl << "Your Overall CGPA for Foundation Journey is " << CGPA4;
		
		outFile.close();
		
		cout << endl << "Your CGPA list is done generate ! Check it at your file saving location !";
		cout << endl << "See you again~ Bye~";
	}
	else if(semester==5) {
		cout << endl << "You are choosing for Main Subject only !\n";
		cout << endl << "There are 4 area for Main Subject :";
		cout << endl << "1. Mathematics";
		cout << endl << "2. Physics";
		cout << endl << "3. Chemistry";
		cout << endl << "4. Computer";
		
		cout << endl << "Start with Mathematics Sector first !";
		cout << endl << endl << "1.1 Intermediate Mathematics : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade19);
		cout << "Pointer: ";
		cin >> pointer19;
		
		GPA19= pointer19*4;
		
		cout << endl << endl << "1.2 Calculus : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade20);
		cout << "Pointer: ";
		cin >> pointer20;
		
		GPA20= pointer20*4;
		
		cout << endl << endl << "1.3 Statistics and Probability : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade21);
		cout << "Pointer: ";
		cin >> pointer21;
		
		GPA21= pointer21*4;
		
		cout << endl << "Then is Physics Turn !";
		cout << endl << endl << "2.1 Physics I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade22);
		cout << "Pointer: ";
		cin >> pointer22;
		
		GPA22= pointer22*4;
		
		cout << endl << endl << "2.2 Physics II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade23);
		cout << "Pointer: ";
		cin >> pointer23;
		
		GPA23= pointer23*4;
		
		cout << endl << endl << "2.3 Physics Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade24);
		cout << "Pointer: ";
		cin >> pointer24;
		
		GPA24= pointer24*2;
		
		cout << endl << endl << "2.4 Physics Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade25);
		cout << "Pointer: ";
		cin >> pointer25;
		
		GPA25= pointer25*2;
		
		cout << endl << "Chemistry is coming !";
		cout << endl << endl << "3.1 Chemistry I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade26);
		cout << "Pointer: ";
		cin >> pointer26;
		
		GPA26= pointer26*4;
		
		cout << endl << endl << "3.2 Chemistry II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade27);
		cout << "Pointer: ";
		cin >> pointer27;
		
		GPA27= pointer27*4;
		
		cout << endl << endl << "3.3 Chemistry Practical I : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade28);
		cout << "Pointer: ";
		cin >> pointer28;
		
		GPA28= pointer28*2;
		
		cout << endl << endl << "3.4 Chemistry Practical II : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade29);
		cout << "Pointer: ";
		cin >> pointer29;
		
		GPA29= pointer29*2;
		
		cout << endl << "Computer: Finally until my turn !";
		cout << endl << endl << "4.1 Computer Literacy : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade30);
		cout << "Pointer: ";
		cin >> pointer30;
		
		GPA30= pointer30*2;
		
		cout << endl << endl << "4.2 Fundamentals of Computing : ";
		cout << endl << "Grade :";
		cin.ignore();
		getline(cin,grade31);
		cout << "Pointer: ";
		cin >> pointer31;
		
		GPA31= pointer31*2;
		
		CGPA5=(GPA19+GPA20+GPA21)/12;
		CGPA6=(GPA22+GPA23+GPA24+GPA25)/12;
		CGPA7=(GPA26+GPA27+GPA28+GPA29)/12;
		CGPA8=(GPA30+GPA31)/4;
		
		cout << endl << "Please wait ! Your CGPA slip is generating now !";
		
		outFile.open("CGPA Main Subject.txt");
		
		outFile << "CGPA Slip";
		outFile << endl << "Type : Main Subject";
		outFile << endl << "Session : Session 2020/2021 & Session 2021/2022";
		outFile << endl << endl << "Student Info";
		
		outFile << endl << "Student Name : " << name;
		outFile << endl << "Student Identity Card Number : " << ic;
		outFile << endl << "Student Matric Number : " << matric;
		outFile << endl << "Student Section : " << section;
		
		outFile << endl << endl << "Student Results\n";
		outFile << "************************************\n";
		
		outFile << endl << "Area: Mathematics\n";
		outFile << endl << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Intermediate Mathematics" << setw(20) << "4" << setw(10) << grade19 <<setw(10) << fixed << setprecision(2) << pointer19 << setw(10) << fixed << setprecision(2) << GPA19;
		outFile << endl << left << setw(50) << "Calculus" << setw(20) << "4" << setw(10) << grade20 << setw(10) << fixed << setprecision(2) << pointer20 << setw(10) << fixed << setprecision(2) << GPA20;
		outFile << endl <<left << setw(50) << "Statistics" << setw(20) << "4" << setw(10) << grade21 <<setw(10) << fixed << setprecision(2) << pointer21 << setw(10) << fixed << setprecision(2) << GPA21;
		
		outFile << endl << endl << "Your average GPA for Mathematics area is " << CGPA5;
		
		outFile << endl << endl << "Area: Physics\n";
		outFile << endl << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Physics I" << setw(20) << "4" << setw(10) << grade22 << setw(10) << fixed << setprecision(2) << pointer22 << setw(10) << fixed << setprecision(2) << GPA22;
		outFile << endl << left << setw(50) << "Physics Practical I" << setw(20) << "2" << setw(10) << grade24 << setw(10) << fixed << setprecision(2) << pointer24 << setw(10) << fixed << setprecision(2) << GPA24;
		outFile << endl << left << setw(50) << "Physics II" << setw(20) << "4" << setw(10) << grade23 <<setw(10) << fixed << setprecision(2) << pointer23 << setw(10) << fixed << setprecision(2) << GPA23;
		outFile << endl << left << setw(50) << "Physics Practical II" << setw(20) << "2" << setw(10) << grade25 <<setw(10) << fixed << setprecision(2) << pointer25 << setw(10) << fixed << setprecision(2) << GPA25;
		
		outFile << endl << endl << "Your average GPA for Physics area is " << CGPA6;
		
		outFile << endl << endl << "Area: Chemistry\n";
		outFile << endl << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "Total";
		outFile << endl << left << setw(50) << "Chemistry I" << setw(20) << "4" << setw(10) << grade26 << setw(10) << fixed << setprecision(2) << pointer26 << setw(10) << fixed << setprecision(2) << GPA26;
		outFile << endl << left << setw(50) << "Chemistry Practical I" << setw(20) << "2" << setw(10) << grade28 << setw(10) << fixed << setprecision(2) << pointer28 << setw(10) << fixed << setprecision(2) << GPA28;
		outFile << endl << left << setw(50) << "Chemistry II" << setw(20) << "4" << setw(10) << grade27 << setw(10) << fixed << setprecision(2) << pointer27 <<  setw(10) << fixed << setprecision(2) << GPA27;
		outFile << endl << left << setw(50) << "Chemistry Practical II" << setw(20) << "2" << setw(10) << grade29 << setw(10) << fixed << setprecision(2) << pointer29 << setw(10) << fixed << setprecision(2) << GPA29;
		
		outFile << endl << endl << "Your average GPA for Chemistry area is " << CGPA7;
		
		outFile << endl << endl << "Area: Computer\n";
		outFile << endl << left << setw(50) << "Subject" << setw(20) << "Credit Hour" << setw(10) << "Grade" << setw(10) << "Pointer" << setw(10) << "GPA";
		outFile << endl << left << setw(50) << "Computer Literacy" << setw(20) << "2" << setw(10) << grade30 << setw(10) << fixed << setprecision(2) << pointer30 << setw(10) << fixed << setprecision(2) << GPA30;
		outFile << endl << left << setw(50) << "Fundamentals of Computing" << setw(20) << "2" << setw(10) << grade31 << setw(10) << fixed << setprecision(2) << pointer31 << setw(10) << fixed << setprecision(2) << GPA31;
		
		outFile << endl << endl << "Your average GPA for Computer area is " << CGPA8;
		
		outFile.close();
		
		cout << endl << "Your CGPA list is done generate ! Check it at your file saving location !";
		cout << endl << "See you again~ Bye~";
				
	}
	else {
		cout << "Wrong Selection !\n";
		cout << "Programme End !\n";
		cout << "Bye ~\n";
	}

	
	return 0;
}

