Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 9 Weeks Ago, 1 Day Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I have this code, I want to understand how to add a sort algorithm for the 10 integers inputed.
Â
#include <iostream>
#define SIZE 10
Â
using namespace std;
Â
// SIGNATURES of all the required Functions
void display(int []);
Â
// MAIN FUNCTION
int main()
{
int arr[SIZE]; // Array to store the integers
Â
Â
// Read the values for the array
cout << "nEnter 10 values in the array (one by one):" << endl;
for(int i =0; i < SIZE; i++){
cin >> arr[i];
}
Â
// Function call to display()
display(arr);
Â
Â
Â
cout << endl;
return 0;
}
Â
Â
// Function display(): To display all the integers in the array
void display(int arr[]){
cout << "nIntegers in the array: " << endl;
Â
// Loop through every index of the array and print it on the screen
for(int i =0; i < SIZE; i++){
cout << arr[i] << " " ;
}
cout << endl;
}
-----------