Answer: provided in the explanation below
Step-by-step explanation:
follow this code to get the required solution, cheers.
#include<iostream>
using namespace std;
#define CAPACITY 100
void print_array(int arr[], int n);
void insert_array(int arr[], int &n, int val);
int main(){
int arr[CAPACITY] = {10,20,30,40,50,60,70,80,90,100};
int n = 10;
print_array(arr, n);
insert_array(arr, n, 25);
print_array(arr, n);
insert_array(arr, n, 5);
print_array(arr, n);
insert_array(arr, n, 55);
print_array(arr, n);
return 0;
}
void print_array(int arr[], int n){
for(int i=0; i<n; i++){
cout<<arr[i]<<" ";
}
cout<<endl;
}
void insert_array(int arr[], int &n, int val){
int pos = -1;
int i=0;
while(arr[i]<val && i<n){
pos = i;
i++;
}
for(i=n; i>pos; i--){
arr[i] = arr[i-1];
}
arr[pos+1] = val;
n++;
}
cheers i hope this helped !!!1