Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int inputx;
- cout << "How many integers do you have? (Max 20)\n";
- cin >> inputx;
- if(!(inputx < 1) && !(inputx > 20))
- {
- int num_array[inputx];
- for(int x = 0; x < inputx; x++)
- {
- cout << "Enter element for subscript " << x << endl;
- cin >> num_array[x];
- }
- cout << "Here are all of those numbers\n";
- for (int x = 0; x< inputx; x++)
- cout << num_array[x] << endl;
- }
- else
- {
- cout << "You must enter a number in between 1 and 20\n";
- exit(0);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment