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]
2 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]2 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
Choose 2 statements that correctly describe the time complexity of data structures with N data.
Softa [21]

The  statements that correctly describe the time complexity of data structures with N data are:

  • The average time complexity of the data lookup in a hash table is O(N).
  • The average time complexity of inserting data into a heap is O(logN)

<h3>What is time complexity of data structures?</h3>

Time Complexity of an algorithm is known to be the depiction of the amount of time needed by the algorithm to carry out to completion.

Note that The  statements that correctly describe the time complexity of data structures with N data are:

  • The average time complexity of the data lookup in a hash table is O(N).
  • The average time complexity of inserting data into a heap is O(logN)

Learn more about data from

brainly.com/question/17350816

#SPJ1

6 0
1 year ago
A=4x^2.(x-2y)-20x.(2y-x)
Luda [366]

Answer:

please give point

6 0
2 years ago
W-11/6=4<br><img src="https://tex.z-dn.net/?f=%20%20%5Cfrac%7Bx%20-%2011%20%7D%7B%206%7D%20%20%3D%204" id="TexFormula1" title="
kozerog [31]

step 1, multiply by 6:

x-11 = 4*6 = 24

step 2, add 11:

x = 35

7 0
2 years ago
Readability is the level of vocabulary used on the page. True or false
konstantin123 [22]

Answer:

FALSE....john has no idea what hes talking about. i knew this was false yet i looked it up and got it wrong anyway because of john its freaking false

Explanation:

8 0
3 years ago
Sam has created a fashion website. There are many subscribers to his website. He has added new blogs, pictures, and articles abo
marusya05 [52]

Answer:

Post advertisements on social media and message the subscribers.

Explanation:

There is no point in not promoting and putting forward the work that he has been doing. All of the given options are about promoting the content but Sam needs to choose the ones which are efficient and seem professional as well.

Posting advertisements about the website promotes the content on a wider base and helps in luring more and more people to the website.

Messaging or sending an email to the subscribers is a healthy of letting the subscribers about the updates and latest posts.

8 0
3 years ago
Other questions:
  • Which statement describes the word "iterative"?
    7·2 answers
  • The max-age attribute of a cookie is specified in
    13·1 answer
  • PLEASE HELP!!!!
    7·1 answer
  • What does social protocol means in network?
    9·1 answer
  • A junior administrator is having issues connecting to a router's console port using a TIA/EIA 568B standard cable and a USB seri
    5·1 answer
  • All of the following are used to fund private schools except ______
    14·2 answers
  • Assume variables SimpleWriter out and int n are already declared in each case. Write a while loop that printsA. All squares less
    11·1 answer
  • Which feature helps an edit-test-bug cycle work faster in the python programming language?
    15·2 answers
  • In this exercise we will practice using loops to handle collections/containers. Your job is to write a program that asks the use
    6·1 answer
  • A wireless ________ extender is a network device that enhances transmission of your wireless signal.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!