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
Given input characters for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: *
MrRa [10]

Answer:

Following are the code to this question:

b= input()#defining b variable for input character value

h= input()#defining h variable for input character value

b_width=6#defining b_width variable that holds an integer value 6

r1 = ' ' * b_width+h#defining r1 variable that calculates hash lines

r2 = b*b_width+h*2#defining r3 variable that calculates 6 asterisk and 2 hash line  

r3 = b*b_width+h*3#defining r3 variable that calculates 6 asterisk and 3 hash line

print(r1)#print r1 variable value

print(r2)#print r2 variable value

print(r3)#print r3 variable value

print(r2)#print r2 variable value

print(r1)#print r1 variable value

Output:

please find the attachment.

Explanation:

In the given python code, three variable "b,h, and b_width" is declared, in which "b_width" holds an integer variable "6" and variable "b and h" is used to an input character value.  In the next line, "r1, r2, and r3" is declared, that holds arrowhead values which can be defined as follows:

  • In the "r1" variable, it stores space with b_width variable and one h variable value.
  • In the "r2" variable it stores b_width and 2*h variable value.
  • In the "r3" variable it stores b_width and 3*h variable value.

At the last, it prints the "r1, r2, and r3" variable value and for arrowheads,  it follows the above program code.

6 0
3 years ago
Someone pls help me do this and don't ask for brainliest or say random answers not related to this.
Marat540 [252]
I used to use pixlr all the time so i should know.
Ok so

1 is picker
2 is lasso select
3 is crop
4 is Liquefy
5 is clone
6 is dodge/burn
7 is Pen
8 is Eraser
9 is Gradient
10 is Text
11 is Zoom
12 is Switch Colors
13 is Marquee Select
14 is Wand select
15 is Cutout/Mask
16 is Heal
17 is Blur/Sharpen
18 is Sponge Color
19 is draw
20 is Fill
21 is I don’t know I have never seen that before
22 is Picker

So sorry if it took a while i did not know what the star was
3 0
3 years ago
Read 2 more answers
What should you do if a headset plugged into your computer is not working properly?
Alex777 [14]

If a headset plugged into computer is not working properly than one can go for updating the device driver. The correct option is B.

<h3>What is a device driver?</h3>

A device driver is a type of software application that allows one hardware device (such as a computer) to communicate with another hardware device (such as a printer). A device driver is indeed referred to as a software driver.

A driver, also known as a device driver, is a collection of files that instructs a piece of hardware on how to operate by communicating with a computer's operating system.

Every piece of hardware, from internal computer components like your graphics card to external peripherals like a printer, requires a driver.

If a headset plugged into a computer is not working properly, the device driver can be updated.

Thus, the correct option is B.

For more details regarding device driver, visit:

brainly.com/question/14054807

#SPJ12

8 0
1 year ago
Read 2 more answers
Function of network security​
myrzilka [38]

Answer:ffffffffffffgggggg

Explanation:vvvc

5 0
3 years ago
Which of the following is NOT essential for individuals to have to build their own web page?
natali 33 [55]
Linux. You do not need Linux as an operating system for your website.
5 0
3 years ago
Other questions:
  • Crashing almost always accelerates the schedule while increasing project risk, whereas fast tracking almost always accelerates t
    10·1 answer
  • Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each t
    9·1 answer
  • Assuming a computer has a single processor and a single core with no support for parallel execution, explain why running a multi
    11·1 answer
  • Sandy's keyboard is not inputting data into her computer which key should she press to verify it is connected to her computer...
    11·1 answer
  • PowerPoint provides a wide variety of predefined shapes that can add visual insert to a slide true or false
    10·2 answers
  • When working on developing an ability, it is important to get feedback to know how you are doing.
    6·1 answer
  • Creating Classes
    10·1 answer
  • Which of these are correctly formatted Python tuples? CHECK ALL THAT APPY.
    15·2 answers
  • Only one person can receive the same email at the same time true or false
    10·1 answer
  • A global clothing company is looking to create a more immersive shopping experience for customers.What is a way the company can
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!