Question: The existing code below reads in a random seed and generates a sequence of numbers and then prints it. Use the reverse algorithm to reverse

The existing code below reads in a random seed and generates a sequence of numbers and then prints it. Use the reverse algorithm to reverse the vector before it is printed. Hint: if you use more than one line of code you are doing it wrong. Note that running this code on your own computer is likely to produce a different random sequence than the one generated by CPPLab. That should not affect your code, just don't be surprised if that happens..

#include #include #include #include #include

using namespace std;

int main() { vector vec;

//Fill vector with random numbers 1-10 int seed; cin >> seed; srand(seed); for(int i = 0; i <= 10; i++) { vec.push_back( rand() % 10 + 1); }

//Do not modify anything on or above the line below this //YOUR_CODE_BELOW

//YOUR_CODE

//YOUR_CODE_ABOVE //Do not modify anything on or below the line above this

//Print the vector for(int i : vec) cout << i << " "; cout << endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!