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
Stolb23 [73]
3 years ago
11

#include

Computers and Technology
1 answer:
Artist 52 [7]3 years ago
3 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

int main() {

const int NUM_VALS = 4;

vector<int> testGrades(NUM_VALS);

int i = 0;

int sumExtra = -9999; // Assign sumExtra with 0 before your for loop

testGrades.at(0) = 101;

testGrades.at(1) = 83;

testGrades.at(2) = 107;

testGrades.at(3) = 90;

/* Your solution goes here */

sumExtra = 0;

for(i = 0; i <= testGrades.size() -1; i++){

   if(testGrades.at(i) > 100){

       sumExtra = sumExtra + (testGrades.at(i) - 100);

   }

}

cout << "sumExtra: " << sumExtra << endl;

return 0;

}

Explanation:

Looks like you almost solved the question. I highlighted the parts you have been missing above.

In order to use vectors in C++, you need to add the vector library at the beginning of the program, #include <vector>

In order to initialize the vector, you need to specify its type inside <int>, since we work with the integers in the question the type must be <em>int</em>

You might be interested in
If an if- else statement is true, it will include which kinds of results?
Salsk061 [2.6K]

In an if...else statement, if the code in the parenthesis of the if statement is true, the code inside its brackets is executed. But if the statement inside the parenthesis is false, all the code within the else statement's brackets is executed instead.

Of course, the example above isn't very useful in this case because true always evaluates to true. Here's another that's a bit more practical:

#include <stdio.h>

int main(void) {

int n = 2;

if(n == 3) { // comparing n with 3 printf("Statement is True!\n");

}

else { // if the first condition is not true, come to this block of code

printf("Statement is False!\n"); } return 0;

}

Output:

Statement is False!

5 0
3 years ago
Imagine that you have an image that is too dark or too bright. Describe how you would alter the RGB settings to brighten or dark
ratelena [41]
Turn the brightness up
7 0
2 years ago
Write the code for invoking a method named sendVariable. There is one int argument for this method. Assume that an int variable
malfutka [58]

Answer:

The code to this question is "sendVariable(x);".

Explanation:

The explanation of the (method calling) code can be given as:

  • In the question, it is defined that there is a method that name is "sendVariable()". In this method, we pass an integer variable that is "x".
  • The variable x value is already declared and assigned and this variable is passed in the method.
  • This method is defined in the same class so the code for calling this method is "sendVariable(x);".

6 0
3 years ago
Alisha appears to be overconfident which makes her unapproachable to her employees. Which negative quality is she displaying?
sergeinik [125]

As the question states Alisha is displaying the quality of overconfidence. This can effect not only herself in her work but also others. She can be demotivated and may even lose confidence completely. This behavior can be fixed by approaching towards her. you can call her very assuming, boldfaced or impertinent

HOPE THIS HELPS. PLEASE THANK AND MARK AS BRAINLIEST : )

7 0
3 years ago
Read 2 more answers
So i need help. my high-school class is using this computer programming site, i have no clue whats going on. anyone use CMU? ill
natali 33 [55]

Answer:

i am in middle school but i know what u mean. it i computer Sciene. dont worry. it i not hard. they might give you intruction on what to do So it wont be So hard. UwU. i belive in u

Explanation:

3 0
3 years ago
Other questions:
  • Software engineering design teams use ________, which are grounded in mathematical concepts of sets and relations, for their sof
    13·1 answer
  • The procedure call mystery(38) will yield which output? __________ a) 0 12 b) 12 0 c) 1 1 0 2 d) 1 1 1 1 e) 2 0 1 1 public void
    11·1 answer
  • Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from
    11·1 answer
  • Most large organizations store data through a strategy called a(n) ________ to promote efficient and safe use of data across the
    11·1 answer
  • The invention of the transistor was important to the development of computers because
    14·1 answer
  • Which style did Jack use on the vocabulary words in reports?
    14·2 answers
  • Which word is most appropriate to describe a laptop?
    5·1 answer
  • Use the drop-down menus to complete each sentence about the layers of the atmosphere.
    14·2 answers
  • How can you represent a graphic element in a wireframe?
    5·1 answer
  • Explain two ways by which the calendar meets or fails to meet the criteria of showing the correct data
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!