Respuesta :
#include
#include
using namespace std;
int main(){
int input[] = {-19, 34, -54, 65, -1};
std::vector voutput:
std::vector vinput (input, input + sizeof(input) / sizeof(int) );
for (std::vector::iterator it = vinput.begin(); it != vinput.end(); ++it)
if(*it > 0) voutput.insert(voutput.begin(), *it);
for(std::vector::iterator it = voutput.begin(); it < voutput.end(); ++it)
std::cout << *it << ‘\n’ ;
return 0;
}
#include
using namespace std;
int main(){
int input[] = {-19, 34, -54, 65, -1};
std::vector voutput:
std::vector vinput (input, input + sizeof(input) / sizeof(int) );
for (std::vector::iterator it = vinput.begin(); it != vinput.end(); ++it)
if(*it > 0) voutput.insert(voutput.begin(), *it);
for(std::vector::iterator it = voutput.begin(); it < voutput.end(); ++it)
std::cout << *it << ‘\n’ ;
return 0;
}
The program is an illustration of vectors; vectors are data structures that are used to hold multiple values in one variable name
The main program
The program written in C++, where comments are used to explain each action is as follows:
#include <iostream>
#include <vector>
using namespace std;
int main(){
//This declares the vector
vector<int> nums;
//This declares an integer variable
int num;
//Thie gets the first input
cin>>num;
//This loops is repeated until the user enters -1
while(num != -1){
nums.push_back(num);
cin>>num; }
//This iterates through the vector
for (auto i = nums.begin(); i != nums.end(); ++i){
//This checks if the current element is above 1
if(*i > 0){
//If yes, the element is printed
cout << *i <<endl;
}
}
return 0;
}
Read more about C++ programs at:
https://brainly.com/question/24027643