Discover the answers you need at Westonci.ca, a dynamic Q&A platform where knowledge is shared freely by a community of experts. Get detailed and accurate answers to your questions from a community of experts on our comprehensive Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
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.
We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. We appreciate your time. Please come back anytime for the latest information and answers to your questions. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.