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
katen-ka-za [31]
4 years ago
8

Write a for loop to print all NUM_VALS elements of vector courseGrades, following each with a space (including the last). Print

forwards, then backwards. End with newline. Ex: If courseGrades = {7, 9, 11, 10}, print:
Engineering
1 answer:
NARA [144]4 years ago
6 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

int main() {

const int NUM_VALS = 4;

vector<int> courseGrades(NUM_VALS);

int i = 0;

courseGrades.at(0) = 7;

courseGrades.at(1) = 9;

courseGrades.at(2) = 11;

courseGrades.at(3) = 10;

/* Your solution goes here */

for (i = 0; i < NUM_VALS; i++){

cout << courseGrades.at(i) << " ";

}

cout << endl;

for (i = NUM_VALS - 1; i >= 0; i--){

cout << courseGrades.at(i) << " ";

}

cout << endl;

return 0;

}

Explanation :

/*

Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1.

Note: These activities may test code with different test values. This activity will perform two tests, the first with a 4-element vector (vector<int> courseGrades(4)), the second with a 2-element vector (vector<int> courseGrades(2)). 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.

*/

You might be interested in
An aluminium alloy tube has a length of 750 mm at a temperature of 223°C. What will be its length at 23°C if its coefficient of
uranmaximum [27]

Answer:

Final length= 746.175 mm

Explanation:

Given that Length of aluminium at 223 C is 750 mm.As we know that when temperature of material increases or decreases then dimensions of material also increases or decreases respectively with temperature.

Here temperature of aluminium decreases so the final length of aluminium decreases .

As we know that

\Delta L=L\alpha\Delta T

Now by putting the values

\Delta L=750\times \25.5\times 10^{-6}\times 200

ΔL=3.82 mm

So final length =750-3.82 mm

Final length= 746.175 mm

3 0
4 years ago
What is the sun's degree angle in the sky in summer and in winter?
Vladimir [108]

Answer:

At the time of the summer or winter solstices, the Sun is 23.44° degrees above or below the horizon, respectively, irrespective of time of day.

Explanation:

6 0
2 years ago
Say that a variable A in CFG G is necessary if it appears in every derivation of some string w ∈ G. Let NECESSARY CFG = {hG, Ai|
ale4655 [162]

Answer:

Explanation:

solution

8 0
3 years ago
Read 2 more answers
Help please really fast!!
ra1l [238]

Answer:368 hdhtygtÿ

901 vuiøöńč

Explanation:

6 0
3 years ago
Knowing that v = –8 m/s when t = 0 and v = 8 m/s when t = 2 s, determine the constant k. (Round the final answer to the nearest
docker41 [41]

Answer:

a)We know that acceleration a=dv/dt

So dv/dt=kt^2

dv=kt^2dt

Integrating we get

v(t)=kt^3/3+C

Puttin t=0

-8=C

Putting t=2

8=8k/3-8

k=48/8

k=6

5 0
3 years ago
Other questions:
  • A PV battery system has an end-to-end efficiency of 77%. The system is used to run an all-AC load that is run only at night. The
    11·1 answer
  • Consider a fully developed laminar flow in a circular pipe. The velocity at R/2 (midway between the wall surface and the centerl
    6·1 answer
  • Why is it important to stop climate change?
    15·2 answers
  • 2 Consider airflow over a plate surface maintained at a temperature of 220°C. The temperature profile of the airflow is given as
    13·1 answer
  • Identify the measurement shown in figure 7 and state in centimeters ​
    5·1 answer
  • WHAT IS THE EFFECT OF ICE ACCRETION ON THE LONGITUDINAL STABILITY OF AN AIRCRAFT?
    8·1 answer
  • Which symbol should be used for the given scenario?
    11·1 answer
  • Report of invertor to convert 12 volt to 220 volt.
    6·1 answer
  • In a wheatstone bridge three out of four resistors have of 1K ohm each ,and the fourth resistor equals 1010 ohm. If the battery
    5·1 answer
  • In an ungrounded electrical systems with conductors installed in grounded metal raceways and enclosures, what is the voltage fro
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!