Create an empty vector v. Then, create a prompt which will continuously ask you for a value to insert into the vector, a
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Create an empty vector v. Then, create a prompt which will continuously ask you for a value to insert into the vector, a
Create an empty vector v. Then, create a prompt which will continuously ask you for a value to insert into the vector, along with the index value. Use the insert function to insert the value at the given index. After every iteration, print the vector. Continue to enter values until someone enters an illegal index value. In that case, end the program. Please enter a value: 7 Please enter an index: 0 7 Please enter a value: 3 Please enter an index: 1 73 Please enter a value: 4 Please enter an index: 1 743 Please enter a value: 9 Please enter an index: 2 7 4 9 3 Please enter a value: 8 Please enter an index: 10 Index value not allowed!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!