
Patrick B. answered 07/04/21
Math and computer tutor/teacher
using namespace std;
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Go()
{
char ** A;
int nRows,nColumns;
nRows = nColumns = 0;
while (nRows<1)
{
cout << " Please input # of rows :> ";
cin >> nRows;
}
while (nColumns<1)
{
cout << " Please input # of columns :> ";
cin >> nColumns;
}
A = (char**)new char*[nRows];
for (int rowLoop=0; rowLoop<nRows; rowLoop++)
{
A[rowLoop] = new char[nColumns];
memset(A[rowLoop],0,nColumns);
}
for (int rowLoop=0; rowLoop<nRows; rowLoop++)
{
cin.clear(); fflush(stdin);
cout << " Please input string # " << (rowLoop+1) << ":>";
cin.getline(A[rowLoop],nColumns);
}
for (int rowLoop=0; rowLoop<nRows; rowLoop++)
{
cout << "string # " << (rowLoop+1) << " >" << A[rowLoop] << "< " << endl;
delete(A[rowLoop]);
A[rowLoop]=NULL;
}
delete(A);
}
int main() { Go(); }
Emmma W.
Thank you sir,you are the best.07/04/21