Question: In C++ Write a program, which will ask the user how many whole numbers they wish to enter. The program will then read that many

In C++

Write a program, which will ask the user how many whole numbers they wish to enter. The program will then read that many numbers using an array of integers, print them in the order they were entered, sort them in order by increasing value, and print them in sorted order. All numbers entered and displayed will be integer values. All numbers must be validated upon entry. The maximum number of integers to be handled will be 20. Sorting will be done in a function where the array will be the first parameter and the number of integers entered into the array will be the second parameter. Use an array to store the integer values. Use the bubble sort algorithm provided in class.

(Bubble Sort Algorithm)

#include

#include "BubbleSort.h"

void BubbleSort (char Letters [])

{

int i;

bool IsSorted;

int NumChars;

char Temp;

NumChars = strlen (Letters);

do {

IsSorted = true;

NumChars--;

for (i = 0; i < NumChars; i++)

if (Letters [i] > Letters [i + 1])

{

Temp = Letters [i];

Letters [i] = Letters [i + 1];

Letters [i + 1] = Temp;

IsSorted = false;

}

else;

} while (!IsSorted);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!