Answer to Question #208536 in C++ for Ahmed Ali

Question #208536

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


1
Expert's answer
2021-06-19T07:00:12-0400
#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);
    
}
 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS