63 152
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #22647 in C++ for airi

Question #22647
how to display a multiplication table with 1-10 fixed (rows)
Expert's answer
#include <conio.h>
#include <iomanip>
#include <iostream>

using namespace std;

void main()
{
/* Print row separating line */
cout << " quot;;
for (int n = 0; n <= 50; n++)
cout << '-';
cout << endl;

/* Print table column headers */
cout << " & |";
for (int n = 1; n <= 10; n++)
cout << setw(3) << n << " |";
cout << endl;

/* Print row separating line */
for (int n = 0; n < 55; n++)
cout << '-';
cout << endl;

for (int row = 1; row <= 10; row++)
{
cout << '|' << setw(3) << row << " |"; //print row header
for (char col = 1; col <= 10; col++)
cout << setw(3) << row * col << " |";
cout << endl;

/* Print row separating line */
for (int n = 0; n < 55; n++)
cout << '-';
cout << endl;
}
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions