#include <iostream>
# include <iomanip>
usingnamespace std;
void lookup ();
int main ()
{
int TimesTable[9][9];
int i = 0;
int j = 0;
int product = 0;
for (i = 1; i < 10; j++)
{
TimesTable [i-1][j-1] = i * j;
cout << "Multiplication Table";
for (j = 0; j < 9; j++)
{
for(i = 0; i < 9; i += 1)
{
cout << setw(3) << TimesTable[i][j] << " ";
cout << endl;
}
lookup();
return 0;
}
}
system("pause");
return 0;
} //end of main function
//**function definition**
void lookup()
{
int x, a, b, c, i, j, TimesTable[9][9];
cout << "Enter any two values: ";
cin >> a >> b;
c = a * b;
cout << "Product = " << c << endl;
} //end of void function
Look at where you're putting your endline. Is that really where you want it to be?
I'm supposed to generate the table and then use the lookup function to do the arithmetic.
Are you sure? Are you sure you're not supposed to use the lookup() function to look up the result in the table?
I mean, it would be weird to write a function to perform a calculation, and call it lookup(). It would be considerably less weird to write a function to look something up, and call it lookup().
Also, it would be weird to create a table of calculation results, and then ignore it and do the calculation over again anyway.