subject
Computers and Technology, 10.10.2020 20:01 oomale

C++ F3 Sort using a 2-Dimension Array of characters 15pts

Task -> Same as last. Implement the function specifications/prototypes. The driver program main() has been supplied.

Input the size of the 2 dimensional character array, then sort by row. Note: this problem is repeated in question 8 but you are required there to modify the ascii code for the sort. Here just use strcmp().

//System Libraries Here
#include //cin, cout
#include //strlen(),strcmp(),strcpy()
using namespace std;

//User Libraries Here

//Global Constants Only, No Global Variables
//Allowed like PI, e, Gravity, conversions, array dimensions necessary
const int COLMAX=80;//Only 20 required, and 1 for null terminator

//Function Prototypes Here
int read(char [][COLMAX],int &);//Outputs row and columns detected from input
void sort(char [][COLMAX],int, int);//Sort by row
void print(const char [][COLMAX],int, int);//Print the sorted 2-D array

//Program Execution Begins Here
int main(int argc, char** argv) {
//Declare all Variables Here
const int ROW=30; //Only 20 required
char array[ROW][COLMAX]; //Bigger than necessary
int colIn, colDet, rowIn, rowDet;//Row, Col input and detected

//Input the size of the array you are sorting
cout<<"Read in a 2 dimensional array of characters and sort by Row"< cout<<"Input the number of rows <= 20"< cin>>rowIn;
cout<<"Input the maximum number of columns <=20"< cin>>colIn;

//Now read in the array of characters and determine it's size
rowDet=rowIn;
cout<<"Now input the array."< colDet=read(array, rowDet);

//Compare the size input vs. size detected and sort if same
//Else output different size
if(rowDet==rowIn&&colDet==c olIn){
sort(array, rowIn, colIn);
cout<<"The Sorted Array"< print(array, rowIn, colIn);
}else{
if(rowDet!=rowIn)
cout<<(rowDet "Row Input size greater than specified.")< if(colDet!=colIn)
cout<<(colDet "Column Input size greater than specified.")< }

//Exit
return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:00
An excel which cell contains =b2 is copied to row below, the same column. what will be the new cell's content
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
Stacy works as blank. the most important soft skill she needs for this role is blank.
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 24.06.2019 00:40
Use a software program or a graphing utility with matrix capabilities to solve the system of linear equations using an inverse matrix. x1 + 2x2 − x3 + 3x4 − x5 = 6 x1 − 3x2 + x3 + 2x4 − x5 = −6 2x1 + x2 + x3 − 3x4 + x5 = 3 x1 − x2 + 2x3 + x4 − x5 = −3 2x1 + x2 − x3 + 2x4 + x5 = 5
Answers: 3
You know the right answer?
C++ F3 Sort using a 2-Dimension Array of characters 15pts

Task -> Same as last. Imp...
Questions
question
Biology, 24.01.2020 20:31
Questions on the website: 13722361