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, 22.06.2019 04:30
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
question
Computers and Technology, 22.06.2019 17:50
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
You know the right answer?
C++ F3 Sort using a 2-Dimension Array of characters 15pts

Task -> Same as last. Imp...
Questions
question
Mathematics, 13.02.2020 06:21
question
Mathematics, 13.02.2020 06:21
question
English, 13.02.2020 06:22
Questions on the website: 13722363