/* multiplication table for the integers 1 to 10 */ #include using namespace std; void printheadings(void); //function prototypes void printrow(int); int main() { printheadings(); for (int m1 = 1; m1 <= 10; m1++) printrow(m1); //m1 = multiplicand system("pause"); return 0; } /* Function printheadings() * Input: * none * Process: * prints headings for a multiplication chart * Output: * prints the table headings */ void printheadings(void) { cout << "\tThis is a Multiplication Table from 1 to 10" << endl << endl; cout.width(5); cout << "X"; /* loop to print the heading of multipliers */ for (int m2 = 1; m2 <= 10; m2++) { cout.width(5); cout << m2; } cout << endl; return; } /* Function printrow() * Input: * m1 - the current multiplicand * Process: * prints a row of a multiplication table by calculating the * first 10 multiples of the multiplicand. * Output: * prints a row of the table */ void printrow(int m1) { cout.width(5); cout << m1; //prints the multiplicand for (int m2 = 1; m2 <= 10; m2++) //m2=multiplier { cout.width(5); cout << m1 * m2; //prints the product } cout << endl; return; }