How to write a c code that can print an array ordered by ind

How to write a c++ code that can print an array ordered by index?

ex. index array

       0        23

       1         4

       2        35

Solution

Solution:

#include<iostream.h>

#include<conio.h>

void main()

{

int arr[20], size, index;

clrscr();

cout << \" Enter size of an array: \";

cin >> size;

cout << \"Enter elements of an array: \";

for( index = 0; index < size; index++)

cin >> arr[ index ];

cout << \" \ index \\t array \ \";

for( index = 0; index < size; index++)

cout << index << \" \\t \" << arr[ index ] << \"\ \";

getch();

}

How to write a c++ code that can print an array ordered by index? ex. index array 0 23 1 4 2 35SolutionSolution: #include<iostream.h> #include<conio.h&

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site