could you please convert this to c it 39 s an insertionsort import java util scanner 5187744
Could you please convert this to C++ it's an InsertionSort
import java.util.Scanner;
public class InsertionSort
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int[] numbers = new int[10];
//Please note that arrays in C++ are not objects
System.out.println(“Please input ” + numbers.length + ” numbersn”);
//Populate array from user
for(int i=0; i
{
numbers[i] = input.nextInt();
}
//print array before sort
System.out.print(“Numbers before sort:”);
for(int i=0; i
{
System.out.print(” ” + numbers[i]);
}
System.out.println();
//Sort the array
for(int i=1; i
{
int temp = numbers[i];
int j = i-1;
while(j >= 0 && numbers[j] > temp)
{
numbers[j+1] = numbers[j];
j–;
}
numbers[j+1] = temp;
}
//print array after sort
System.out.print(“Numbers after sort:”);
for(int i=0; i
{
System.out.print(” ” + numbers[i]);
}
System.out.println();
}
}