subject

For C++ ONLY please, Write a for loop to print all NUM_VALS elements of vector courseGrades, following each element with a space (including the last). Print forwards, then backwards. End with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print:
7 9 11 10
10 11 9 7
Hint: Use two for loops. Second loop starts with i-courseGrades. size() - 1 (Notes)
Note: These activities may test code with different test values. This activity will perform two tests, both with a 4-element vector (vector int> courseGrades(4)). See "How to Use zyBooks".
Also note: If the submitted code tries to access an invalid vector element, such as courseGrades at(9) for a 4-element vector, the test may generate strange results. Or the test may crash and report "Program end never reached', in which case the system doesn't print the test case that caused the reported message.
1 #include
2 #include
3 using namespace std; DIIDII
4
5 int maino {
6 const int NUM_VALS - 4;
7 vector int> courseGrades (NUM_VALS);
8 int i;
9
10 for (i = 0; i < courseGrades. size(): ++) {
11 cin >> courseGrades. at(i); /*
12 }
13
14 Your solution goes here */
15
16 return ;
17 }

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:00, AngiT
Which spereadsheet type will determine how well a bussiness has done over the past year
Answers: 1
image
Computers and Technology, 22.06.2019 07:20, Hcalhoun21
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
image
Computers and Technology, 23.06.2019 03:30, mem81
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
image
Computers and Technology, 23.06.2019 13:50, mrfishyyyy
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
You know the right answer?
For C++ ONLY please, Write a for loop to print all NUM_VALS elements of vector courseGrades, follow...

Questions in other subjects:

Konu
English, 04.12.2020 17:40
Konu
History, 04.12.2020 17:40
Konu
History, 04.12.2020 17:40