Write a C++ Program to Calculate Percentage, GPA, CGPA.
Use File Handling and multiple inheritance concept and other c++ logics also.
The Output should include:
1)Percentage
2)GPA
3)CGPA
4)Exit
#include<bits/stdc++.h>
using namespace std;
double Marks(double mks[], int n)
{
double g[n];
double cgpa;
double sum = 0;
for(int i = 0; i < n; i++)
{
g[i] = (mks[i] / 10);
}
for(int i = 0; i < n; i++)
{
sum += g[i];
}
cgpa = sum / n;
return cgpa;
}
int main()
{
int num = 6;
double marks[] = { 79,67,64,78,90,97};
double cgpa = Marks(marks, num);
cout << "CGPA = ";
printf("%.1f\n", cgpa);
cout << "Percentage = ";
printf("%.2f", cgpa * 9.5);
}
Comments
Leave a comment