Write C Program Declare Array Size 15 Initialized 10 Integers Include Function Showarray D Q37246132

Write a c++ program to declare an array of size 15 initialized with10 integers. Include a function show_array that can display thecontents of the array. The program should then call a functionsort_array to sort the array; and again call the show_arrayfunction to display the sorted array. It then calls a functioninsert_sorted that inserts an element in the appropriate positionin the sorted array. Finally, the program calls show_array again todisplay the array after insertion of the value.


Answer


C++ code

============================================================================================

#include<iostream>

using namespace std;

//insert in sorted array
void insert_sorted(int array[], int n, int value)
{
int i;
for (i=n-1; i >= 0 && array[i] >value; i–)
{
   

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.