turbo sort codechef solution code example

Example: turbo sort codechef solution

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	int number;
	cin >> number; //input no. of elements
	int arr[number]; //defining array with size of no. of elements
	for (int i = 0; i < number; i++) { //Loop to insert values into array
	    cin >> arr[i]; 
	}
	sort(arr,arr+number); //in-built sort function to sort array in ascending order
	for(int i=0;i<number;i++){ //Loop to output elements of array
	    cout<<arr[i]<<"\n";
	}   
	return 0;
}

Tags:

Cpp Example