One Dimensional Array Exercise
Create a C++ program named ex1_1DArray.cpp
in the Visual Studio project or create it in your IDE.
Your program will include the following:
- Declare an integer array of size 10
- Ask user to enter 10 numbers for the array
- Print out the array in index ascending order (print from position 0 to 9, do not sort)
- Print out the array in index descending order (print from position 9 to 0, do not sort)
- Find the sum of the array and print it out
Your results should look something like this:
> ex1_1DArray
Please give me 10 numbers:
3
8
123
6
1
9
3
0
42
9001
Index Ascending: 3 8 123 6 1 9 3 0 42 9001
Index Descending: 9001 42 0 3 9 1 6 123 8 3
The Total is: 9196
Please give me 10 numbers:
3
8
123
6
1
9
3
0
42
9001
Index Ascending: 3 8 123 6 1 9 3 0 42 9001
Index Descending: 9001 42 0 3 9 1 6 123 8 3
The Total is: 9196
When you are done:
- Take a screenshot of your IDE and console window showing the compile command and one run with 10 numbers of your own.
- For this exercise, you will have:
ex1_1DArray.cpp
. - Complete all the exercises in this lab and upload the .cpp files and screenshots to URCourses.