Question: Practice 01 (A): One Dimensional Array (5 marks) 1. Copy, compile and run the program of Code_Examplel.cpp. Type 1 to 10 when ask for input.

 Practice 01 (A): One Dimensional Array (5 marks) 1. Copy, compileand run the program of Code_Examplel.cpp. Type 1 to 10 when askfor input. The program will produce the following output as shown in

Practice 01 (A): One Dimensional Array (5 marks) 1. Copy, compile and run the program of Code_Examplel.cpp. Type 1 to 10 when ask for input. The program will produce the following output as shown in Figure 6.1. Note that the program is unable to display the correct value. Type 10integer numbers. Data #1:1 Data #2:2 Data #3:3 Data #4:4 Data #5:5 Data #6:6 Data #7:7 Data #8:8 Data #9:9 Data #10:10 10 Display in reverse order Data #10: 10 Data #9: 10 Data #8: 10 Data #7: Data #6: 10 Data #5: 10 Data #4: 10 Data #3: 10 Data #2: 10 Data #1: 10 Data #0 : 10 Press any key to continue. Figure 6.1: Output Program 6.1 2. Now, without changing the original code, fix the program using array. Fix the C++ code at the highlighted lines as shown in Program 6.1. Then compile and run. Input the data as in Figure 6.1. Make sure you display the correct value. 1/Program 6.1: Working with arrays /* The main function calls a user-defined function named readData without transfers anything. The myProgram reads the input from the user up to 10 integer numbers. Then, it displays it in reverse order. */ #include #include using namespace std; const int N 10; void myProgram(void); //prototype of myProgram int main(void) { my Program(); //calls my Program and transfers nothing system ("pause"); return ; ; } //** *** my Program function // Read up to 10 integer numbers // Then, write the numbers back to the screen in its reverse order. //***** **** void my Program(void) { const int noof Input = 10; int data[noof Input]={0}; /*declare data as an array and intialise set element with */ cout >data[i]; /*store the input value in the data array */ } 1/Display the input in reverse order cout =0; i--) { cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!