注册 登录
编程论坛 C++教室

[求助]九九乘法表

jerry931230 发布于 2007-06-02 21:26, 1218 次点击
九九乘法表
.cpp(3) : error C2239: unexpected token '{' following declaration of 'main'
错在那里??



#include<iostream>
int main
{
int a,b;
for(a=0,a<=9,a++);
for(b=0,b<=a,b++);
{
cout<<a&"*"&b&"="<<a*b<<" ";
}
cout<<endl;
}
10 回复
#2
aipb20072007-06-02 21:28
int main(){
//
}
#3
tancui2007-06-02 21:58
return 0
#4
zh760294122007-06-02 22:14

99乘法表如下:
#include <stdio.h>
void main()
{
}

#5
chwen8222007-06-02 22:30

兄弟你这个程序错太多了
首先#include<iostream.h>
int main ()
其次 for语句后面不应有分号,其括号内应是三条语句,故改逗号为分号;
还有 cout 语句有问题

#6
chwen8222007-06-02 22:33

还忘了一句 主函数还要加一句 return 0;

#7
aipb20072007-06-02 23:19
main函数可以不return 0的。允许省略!
#8
jerry9312302007-06-03 11:10
#include<iostream.h>
int main()
{
int a,b,n;
for(a=0;a<9;a++);
{
for(b=0;b<a;b++);
{
n=a*b;
cout<<a<<"*"<<b<<"="<<n<<" ";
}
cout<<endl;
}
return 0;
}
#9
jerry9312302007-06-03 11:11

最后为什么是
9*9=81
Press any key to continue

#10
边城路人2007-06-04 09:16
9*9当然是81了
#11
李震2007-06-04 16:36
#include<stdio.h>
void main()
{
int a,b,n;
for(a=1;a<=9;a++)
{
for(b=1;b<=a;b++)
{
n=a*b;
printf("n=");
printf("%d%c%d",a*b);
printf("\n");
}
}
1