Question: Problem #3 (Spreadsheet Stuff) Class Specifications template class Prb3Tab { protected: int rows; //Number of rows in the table int cols; //Number of cols in
Problem #3 (Spreadsheet Stuff)
Class Specifications
template
class Prb3Tab
{
protected:
int rows; //Number of rows in the table
int cols; //Number of cols in the table
T *rowSum; //RowSum array
T *colSum; //ColSum array
T *table; //Table array
T grndTot; //Grand total
void calcTab(void); //Calculate all the sums
public:
Prb3Tab(char *,int,int); //Constructor then Destructor
~Prb3Tab(){delete [] table;delete [] rowSum;delete [] colSum;};
const T *getTab(void){return table;};
const T *getRow(void){return rowSum;};
const T *getCol(void){return colSum;};
T getGdTot(void){return grndTot;};
};
template
class Prb3TbI:public Prb3Tab
{
protected:
T *augTab; //Augmented Table with sums
public:
Prb3TbI(char *,int,int); //Constructor
~Prb3TbI(){delete [] augTab;}; //Destructor
const T *getAugT(void){return augTab;};
};
Driver code
cout<<"Entering problem number 3"< int rows=5; int cols=6; Prb3TbI const int *naugT=tab.getTab(); for(int i=0;i { for(int j=0;j { cout< } cout< } cout< const int *augT=tab.getAugT(); for(int i=0;i<=rows;i++) { for(int j=0;j<=cols;j++) { cout< } cout< } Example Input Table 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 128 Example Output Table with rows summed, columns summed and the grand total printed. 100 101 102 103 104 105 615 106 107 108 109 110 111 651 112 113 114 115 116 117 687 118 119 120 121 122 123 723 124 125 126 127 128 128 758 560 565 570 575 580 584 3434
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
