1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vladimir2022 [97]
3 years ago
14

Write a user-defined function that calculates the GPA. For the function name and arguments, use the following: The input argumen

t g is a vector whose elements are the numerical values of the grades. The input argument h is a vector with the corresponding credit hours. The output argument GPA is the calculated GPA. Use the function to calculate the GPA for a student with the following record
Computers and Technology
1 answer:
QveST [7]3 years ago
7 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

void calGPA();

vector<int> g;

vector<int> h;

int main(){

   char pushMore = 'y';

   int fg, fh;

   for (;;){

       if (pushMore == 'n'){

           break;

       } else{

           cout<< "Enter integer for grade: ";

           cin>> fg;

           cout<< "Enter integer for credit hours: ";

           cin>> fh;

           g.push_back(fg);

           h.push_back(fh);

           cout<< "Do you want to add more grade and credit hours? y/n: ";

           cin>> pushMore;

       }

   }

   calGPA();

}

void calGPA(){

   double total = 0, GPA;

   for (int i = 0; i < g.size(); ++i) {

        total +=  g.at(i) * h.at(i) ;

   }

   cout<< "The GPA is : "<< total/g.size();

}

Explanation:

The C++ source code above defines two vectors 'g' and 'h'. The latter holds the grades of a student while the former holds the credit hours for the subject taken. The void 'calGPA' function calculates and prints the student's GPA.

You might be interested in
Is anyone else recieving a notification from brainly near the search bar about a message and click it and there nothing there???
Yakvenalex [24]

tessa the same with me I hate it and then I'll click I and then it's blank

4 0
4 years ago
A camera in manual mode means of the camera will make all the adjustments for the photographer
galben [10]
Manual mode is when the photographer makes all the adjustments themself
7 0
4 years ago
Please can someone solve this question<br>What is a software and types of software​
castortr0y [4]

Explanation:

Software is a set of programs, which is designed to perform a well-defined function. A program is a sequence of instructions written to solve a particular problem. There are two types of software − System Software. Application Software.

8 0
3 years ago
What general (system) recommendations might you make to the shop manager? (For example. if the system will be integrated, what m
Amiraneli [1.4K]

Answer:

Explanation:

1. 2 Modules that can be used for systems

integrations are

A. Automation integration modules

B. Flownex integration modules

2. Benefit of systems integration

A. It helps improves efficiency in integrating with external softwares

B. It helps with business to businesses communications and enhances interrnal co-operation within organization.

4 0
4 years ago
Which of the following helps create a positive community?
Lera25 [3.4K]

Answer: D.) all of the above

Explanation: By doing all three of these it makes almost everyone in the community is happier and more positive which is better than the bully's & people who don't speak up feel less entitled, it achieves the goal.

5 0
3 years ago
Other questions:
  • an internet connectivity plan is also known as a ________. a) text plan b) data plan c) mobile plan d) network plan
    8·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • Which of the following are valid values for a String? (Select all that apply)
    7·1 answer
  • Which studio produced the film the jazz singer the first of many talkies
    11·1 answer
  • 1000base-t is a standard for achieving throughputs ____ times faster than fast ethernet over copper cable.
    8·1 answer
  • Outputting all combinations. Output all combinations of character variables a, b, and c using this ordering abc acb bac bca cab
    7·1 answer
  • Which of these is not an application software?
    6·2 answers
  • Kamal plans to offer new, more favorable contracts to business customers who are now receiving a discount and use wireless servi
    7·1 answer
  • Say yes if you hate edge2021?
    8·2 answers
  • State two differences between a mouse pointer and a mouse cursor​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!