You are viewing a single comment's thread. Return to all comments →
Here's my pretty simple solution. I don't think this is too complicated. Unless you've never used vectors before. You could clean this up. A lot.
#include <iostream> #include <vector> using namespace std; int main() { vector<int> numArray; int maxNums; int nums; cin >> maxNums; for(int i = 0; i < maxNums; i++) { cin >> nums; numArray.push_back(nums); } int loop = maxNums; for(int i = 0; i < maxNums; i++) { cout << numArray[loop-1]; cout << " "; loop--; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
Here's my pretty simple solution. I don't think this is too complicated. Unless you've never used vectors before. You could clean this up. A lot.