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
Date criteria are automatically enclosed in ____ when entered in a query design.
inysia [295]
Enclosed in number signs ######
4 0
3 years ago
Digital Media Equipment: Best Practices Quiz
natulia [17]
  1. <u>False:</u> Location of a video or photoshoot is not important when it comes to preplanning the shoot.
  2. <u>True:</u> Booms are large adjustable poles to mount microphones.
  3. <u>False:</u> It doesn't matter what you clean your camera lens with- you should just grab whatever cloth you have.
  4. <u>True:</u> Safety should be the most important thing when conducting a photo or video shoot.
  5. <u>True:</u> It's important to properly clean and store your equipment after a photo or video shoot.

<h3>What is a photoshoot?</h3>

A photoshoot can be defined as a photography session that involves the use of <u>digital media</u> equipment to take series of pictures (photographs) of models, things or places, etc., especially by a professional photographers.

<h3>The digital media equipment in a photo or video shoot.</h3>

Some examples of the <u>digital media</u> equipment that are used in a photo or video shoot include the following:

  • Boom
  • Camera
  • Microphone
  • Lenses
  • Battery
  • Tripod

Read more on photoshoot here: brainly.com/question/26643795

4 0
2 years ago
In a computer-controlled greenhouse, a temperature sensor and a window motor are connected to the computer.
GrogVix [38]
Hope this helps solve it

8 0
2 years ago
What phrase indicates someone has knowledge and understanding of computer,internet,mobile devices and related technologies?
navik [9.2K]

Digital literacy is the term for having knowledge of computers, internet, mobile devices and related technologies.

7 0
3 years ago
Simple mail transfer protocol (smtp) uses the well-known port number ______________ by default.
Elden [556K]
I believe it's default is port 587. 
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the opportunity cost of computers when moving from point A to point B? -15 DVDs b. What is the opportunity cost of compu
    13·1 answer
  • Proxy data:
    12·1 answer
  • The term ________ refers to the use of a single unifying device that handles media, internet, entertainment, and telephone needs
    13·1 answer
  • Describe network in terms of the class computer lab
    9·1 answer
  • Write a function that will alphabetize a string WITHOUT using the sort function :
    7·1 answer
  • What are the two types of lighting?
    7·2 answers
  • #Write a function called hide_and_seek. The function should #have no parameters and return no value; instead, when #called, it s
    7·1 answer
  • __________ are the first line of defense against unsafe drivers.
    5·1 answer
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
  • Which of the following tabs on the Ribbon contains the commands for adding tables, pictures and shapes into a publication? Quest
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!