Define a function to input a list of names and store them as dynamically-allocated strings in an array,
and a function to output them:
void ReadNames (char *names[], const int size);
void WriteNames (char *names[], const int size);
Write another function which sorts the list using bubble sort:
void BubbleSort (char *names[], const int size);
Bubble sort involves repeated scans of the list, where during each scan adjacent items are compared
and swapped if out of order. A scan which involves no swapping indicates that the list is sorted.
1
Expert's answer
2015-07-03T03:10:04-0400
#include <iostream>
using namespace std;
// The function prototypes void ReadNames(char *names[], const int size); void WriteNames(char *names[], const int size); void BubbleSort(char *names[], const int size);
Comments
Leave a comment