这是书上的练习题,原题是这样的
然后这是我写的
这都没啥毛病,然后今天学了函数调用,课后习题让用函数调用的方式打印这个乘法表
这是我的
究竟是哪里出了问题?麻烦详细回答一下并给出正解
这是书上的练习题,原题是这样的
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
void getResult()
{
int i,j,c;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
{
c=i*j;
cout<<i<<"*"<<j<<"="<<setw(2)<<c<<" ";
}
cout<<endl;
}
cout<<endl;
}
int main()
{
getResult();
system("pause");
return 1;
}