Page 1 of 1

Integers are read from input and stored into a vector until 0 is read. Output the elements in the vector, replacing any

Posted: Thu Jul 14, 2022 2:07 pm
by answerhappygod
Integers Are Read From Input And Stored Into A Vector Until 0 Is Read Output The Elements In The Vector Replacing Any 1
Integers Are Read From Input And Stored Into A Vector Until 0 Is Read Output The Elements In The Vector Replacing Any 1 (76.11 KiB) Viewed 25 times
#include <iostream>#include <vector>using namespace std;
int main() { int i; vector<int> intVector; int value;
cin >> value; while (value != 0) { intVector.push_back(value); cin >> value; }
z /* Your code goes here */
return 0;}
Integers are read from input and stored into a vector until 0 is read. Output the elements in the vector, replacing any elements greater than the vector's last element with "SKIP". End each number with a newline. Ex: If the input is 5−3−1540, the vector's last element is 4 . Thus, the output is: SKIP −3 −15 4 Note: A vector's back() function returns the vector's last element. Ex: myVector.back0 1 #include 2 #include 3 using namespace std; 4 5 int main() \{ 6 int i; 7 vector < int > intVector; 8 int value; 10 cin ≫ value; 11 while (value !=0){ 12 intVector,push_back(value); 13 cin > value; 143