17.3k views
5 votes
Write a C++ Win32 Console Application that will use nested for loops to generate a multiplication table from 1 x 1 to 10 x 10. Use the "tab" escape sequence ("\t") to format the table properly.

User Haseeb A
by
8.3k points

1 Answer

3 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

for (int outer = 1; outer <= 10; outer++)

{

for (int inner = 1; inner <= 10; inner++)

{

cout << inner << "\tx\t" << outer << "\t=\t" << inner*outer << endl;

}

cout << endl;

}

}

Step-by-step explanation:

I think when you replace the tabs by spaces, the layout is more pleasing. Couldn't figure out if you can override the default tab size of 8 characters...

User Tails
by
7.5k points