I am new in C++ programming. I got a question that I don't know how to answer. It is about sorting two dimensional arrays. So here is the question. I must create a code that it can accept 5 names and sort in both ascending and descending order. The thing is I don't know how to sort it in 2 Dimensional array. So please I need your help. Thanks.
Here is the code i done so far:
//bubble sort alphabets
using namespace std;
cout<<"Enter 5 alphabets\n";
for (int i=0 ; i<5; i++)
for (int j=0; j < 5 - i - 1; j++)
if (arr[j] > arr[j+1])
swap = arr[j];
arr[j] = arr[j+1];
arr[j+1] = swap;
cout<<"Sorted list in ascending order:\n";
for (int i = 0 ; i < 5 ; i++ )
Please help in creating a 2D(2 dimensional array) code.
Oh,if I am in the wrong topic please tell where should I post this question to get help.Thank you and God Bless.