Write a program that (a) generates a vector with 20 random integer elements with integers between -10

Question:

Write a program that (a) generates a vector with 20 random integer elements with integers between -10 and 10, (b) replaces all the negative integers with random integers between -10 and 10, (c) repeats (b) until all the elements are positive. The program should also count how many times (b) is repeated before all the elements are positive. When done, the program displays the vector and a statement that states how many iterations were needed for generating the vector.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: