I'm having a hard time understanding how to sort loops and the different types.
I've read several articles, reviewed several programs, and still cannot grasp how to sort arrays let alone do anything else with them, I.E. add rows/columns, find the mode, ect...
I know the different types of sorts, selection, bubble, and from what I've seen, it seems bubble sorting is the easiest, but I still don't understand how its done. I'm not looking for someone to 'do' a program for me, but rather just help me grasp it through examples.
here is a basic program that asks a user to input rows and columns, and displays it accordingly with random numbers between 1-9.
How do you start the sorting code? Which is more effective or universal for sorting?
and lastly how would you go about getting the program identifying numbers in the array and having them multiply, add, find median, mode, least occurring ect...
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int put, puts;
cout << "how manny columns?"<<endl;
cin >> puts;
cout << "how many rows?"<<endl;
cin >> put;
int ROW = put;
int COL = puts;
int array[ROW][COL];
srand(time(NULL));
for(int r = 0; r < ROW; r++) //row
{
for(int c = 0; c < COL; c++)//column
{
array[r][c] = rand()%10;//setting numbers in array to random
cout<<array[r][c]<< " ";//print array
}
cout<<endl;
}
return 0;
}