subject
Computers and Technology, 04.04.2020 10:58 zero101

#include
#include
using namespace std;

/*
Vector testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.
*/

int main() {
const int NUM_VALS = 4;
vector 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;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
You install teamviewer on your workstation at home so that you can ac ess it when on the road. how can you be assured that unknown users cant access your computer through team viewer?
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
In which view can you see speaker notes?
Answers: 1
You know the right answer?
#include
#include
using namespace std;

/*
Vector testGrades contains...
Questions
question
Mathematics, 19.04.2021 04:00
question
Mathematics, 19.04.2021 04:00
question
Mathematics, 19.04.2021 04:00
question
Mathematics, 19.04.2021 04:00
question
Mathematics, 19.04.2021 04:00
Questions on the website: 13722363