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
astraxan [27]
3 years ago
6

Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSi

ze = 3, then countDown = {3, 2, 1}, and the sample program outputs:
#include
#include
using namespace std;
int main() {
vector countDown(0);
int newSize = 0;
int i = 0;
newSize = 3;
STUDENT CODE
for (i = 0; i < newSize; ++i) {
cout << countDown.at(i) << " ";
}
cout << "Go!" << endl;
return 0;
}
Computers and Technology
1 answer:
strojnjashka [21]3 years ago
4 0

Answer:

Following are the code to the given question:

#include <iostream>//defining header file

#include <vector>//defining header file

#include <numeric>//defining header file

using namespace std;

int main()//main method

{

vector<int> countDown(0);//defing an integer array variable countDown

int newSize = 0;//defing an integer variable newSize that holds a value 0

int i = 0;//defing an integer variable i that initialize with 0

newSize = 3;// //use newSize to hold a value

countDown.resize(newSize,0);// calling the resize method that accepts two parameters

for (i = 0; i < newSize; ++i)//defining a loop that reverse the integer value

{

countDown[i] = newSize -i;//reverse the value and store it into countDown array

cout << countDown.at(i) << " ";//print reverse array value

}

cout << "Go!" << endl;//print message

return 0;

}

Output:

3 2 1 Go!

Explanation:

In the given code inside the main method an integer array "countDown" and two integer variables "newSize and i" is declared that initializes a value that is 0.

In the next step, an array is used that calls the resize method that accepts two parameters, and define a for a loop.

In this loop, the array is used to reverse the value and print its value with the message.

You might be interested in
So i'm trying to figure out why this code wont run can anyone help me
MaRussiya [10]

Answer:

<em><u>use</u></em><em><u> </u></em><em><u>the</u></em><em><u> </u></em><em><u>ope</u></em><em><u>ning</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>cl</u></em><em><u>osing</u></em><em><u> </u></em><em><u>tags</u></em><em><u> </u></em>

<em><u>[</u></em><em><u>Tex]</u></em><em><u> </u></em><em><u>[</u></em><em><u>\</u></em><em><u>t</u></em><em><u>e</u></em><em><u>x</u></em><em><u>]</u></em><em><u> </u></em><em><u>ok</u></em>

8 0
2 years ago
Helpppp plsssss!!!<br><br>thanks.
sattari [20]
I believe the answer is A
6 0
2 years ago
Technician A says that temperature sensors decrease in resistance as the temperature​ increases; this is called positive tempera
Reika [66]

Answer:

Technician B.

Explanation:

The claim of technician B that some vehicle manufacturers use a stepped ECT circuit inside the PCM to broaden the accuracy of the sensor is correct.

6 0
3 years ago
Which of the following is a safe work practice to protect you from electrocution hazards?
Flura [38]
What are the answer choices?
7 0
3 years ago
Assume the following variables are defined: int age; double pay; char section; write a single c instatement that will read input
JulsSmile [24]

Answer:

scanf("%d %lf %c", &age, &pay, &section);

Explanation:

To read the value in c program, the instruction scanf is used.

To read the integer value, use the %d format specifier in the scanf and corresponding variable name age with ampersand operator.

To read the double value, use the %lf format specifier in the scanf and corresponding variable name pay with ampersand operator.

To read the character value, use the %c format specifier in the scanf and corresponding variable name section with ampersand operator.

5 0
3 years ago
Other questions:
  • How do I download the Microsoft word on my Hp probook
    8·2 answers
  • Violations of security policies are considered to be a(n) __________ issue upon which proper disciplinary actions must be taken.
    7·1 answer
  • What connectors are available for components to be connected externally to the motherboard
    12·2 answers
  • In an oblique drawing, which lines can be measured accurately, if there is no foreshortening?
    10·1 answer
  • How do media and networks interact? A. Networks and media work in exactly the same way. B. Media are connected to networks that
    8·1 answer
  • Search engines enable you to
    12·1 answer
  • What word describes a violation of copyright laws? What rights do copyright holders have over their work of art
    5·2 answers
  • Free brainliest hehehehehehehheheh
    13·2 answers
  • If I got a monitor and kept my garbage laptop could I play games on max graphics?
    13·1 answer
  • Create a vector of structures experiments that stores information on subjects used in an experiment. Each struct has four fields
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!