C++编程题

fpc 2004-03-29 01:08:03
用C++做出下面打印结果
* 1 2 3 4 5 6 7 8 9
------------------------------(课本上的这条线不是占一行的。是在数的下面
1 1 2 3 4 5 6 7 8 9
2 2 4 6 8 10 12 14 16 18

(中间我不写了。这是九九乘法表)

9 9 18 27 36 45 54 63 72 81
...全文
38 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
plpl574 2004-04-06
  • 打赏
  • 举报
回复
......................................?
fpc 2004-04-05
  • 打赏
  • 举报
回复
看看我们做得吧
#include<iostream.h>
#include<iomanip.h>
void main()
{
int i,j;
cout<<"*";
for(i=1;i<=9;i++)
{
cout<<setw(4)<<i;
if(i==9)
cout<<"\n";
}
cout<<"......................................";

for(i=1;i<=9;i++)
{
cout<<"\n"<<i;
for(j=1;j<=9;j++)
cout<<setw(4)<<i*j;
cout<<endl;
}
}
fpc 2004-04-05
  • 打赏
  • 举报
回复
有意见吗?
我有的是分数。
怎么样?
到时候看谁比谁历害
caohoujie 2004-04-04
  • 打赏
  • 举报
回复
晕倒,这种问题也拿出来问
ckp 2004-04-01
  • 打赏
  • 举报
回复
还有,是要显示还是打印也没有说清楚。
ckp 2004-04-01
  • 打赏
  • 举报
回复
到底应该用图形方式,还是用字符方式?没有说清楚。
danielpan 2004-04-01
  • 打赏
  • 举报
回复
如果说只是打印99表,楼上的基本上都行.

但是那条线.....

根据楼主说,那条线不是占一行的,要用图形函数画阿.
alittlesheep 2004-04-01
  • 打赏
  • 举报
回复
num[10][10],二维数组!
fpc 2004-03-31
  • 打赏
  • 举报
回复
num[10][10]用到了什么知识啊?
fpc 2004-03-30
  • 打赏
  • 举报
回复

msxiaoguo(小郭) 的using namespace std
是什么意思?
请大家可以用较初等的方法来写程序吗?因为我才学到函数那一章。。所以很多你们写的我都看不懂。
谢谢了
我看得懂得才给分哦。
谢谢帮忙

wdslhr 2004-03-30
  • 打赏
  • 举报
回复
#include <iostream.h>
#include <math.h>
class chengfa
{
public:
chengfa(){}
~chengfa(){}
void cheng();
private:
int i,j,count;

};

void chengfa::cheng( )
{

cout<<"*"<<"\t";
for (i=1;i<=9;i++)
{
cout<<i<<"\t";
}
cout<<"\n";
for (i=1;i<=9;i++)
{ cout<<i<<"\t";
for (j=1;j<=9;j++)
{count=i*j;
cout<<count<<"\t";
}
cout<<"\n"<<endl;
}

}

void main()
{
chengfa biao ;
biao.cheng();
}
wdslhr 2004-03-30
  • 打赏
  • 举报
回复
#include <iostream.h>
#include <math.h>
class chengfa
{
public:
chengfa(){}
~chengfa(){}
void cheng();
private:
int i,j,count;

};

void chengfa::cheng( )
{

for (i=1;i<=9;i++)
{for (j=1;j<=9;j++)
{count=i*j;
cout<<count<<"\t";}
cout<<"\n"<<endl;
}

}

void main()
{
chengfa biao ;
biao.cheng();
cout<<"\n"<<endl;
}

楼主,这个简单C++可实现你的功能。
msxiaoguo 2004-03-30
  • 打赏
  • 举报
回复
using namespace std;是ANSI的命名空间,在cin cout,endl等中
不然要写std::cout<<" "std::endl;
当然一般编译器可以不要
msxiaoguo 2004-03-29
  • 打赏
  • 举报
回复
#include <iostream.h>
using namespace std
int main()
{int num[10][10];//如果不保存,可以不要
inti,j,k;
char ch=196;
cout<<'*';
num[1][1]=0;//如果不保存,可以不要
for(i=1;i<10;i++)
{
for(j=1;j<10;j++)
{ cout<<i*j;
num[i][j+1]=i*j;//如果不保存,可以不要
}
cout<<endl;
for(k=1;k<10;k++)
{ cout<<ch;
}
cout<<endl;
cout<<i;
num[i][j]=i;//如果不保存,可以不要
}
}
zzj0616 2004-03-29
  • 打赏
  • 举报
回复
应该是
#include <iostream.h>

void main()
{
int i, j;
int a[10][10];

for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
a[0][j] = j;
a[j][0] = j;

if(i!=0 && j!=0)
a[i][j] = i * j;
cout << "\t" << a[i][j];
}
if(j==1)
cout<<"------------------------------";
cout << endl;
}
}
zzj0616 2004-03-29
  • 打赏
  • 举报
回复
楼上的朋友说的不对,没有打印----------------------------
#include <iostream.h>

void main()
{
int i, j;
int a[10][10];

for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
a[0][j] = j;
a[j][0] = j;

if(i!=0 && j!=0)
a[i][j] = i * j;
cout << "\t" << a[i][j];
if(j==1)
cout<<"------------------------------";
}
cout << endl;
}
}
cybernaute 2004-03-29
  • 打赏
  • 举报
回复
#include <iostream.h>

void main()
{
int i, j;
int a[10][10];

for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
a[0][j] = j;
a[j][0] = j;

if(i!=0 && j!=0)
a[i][j] = i * j;
cout << "\t" << a[i][j];
}
cout << endl;
}
}
fpc 2004-03-29
  • 打赏
  • 举报
回复
小弟初学C++大家帮忙谢谢了

15,440

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧