| 查看: 609 | 回复: 7 | |||
[交流]
【已解决】高手,帮一下忙 已有3人参与
|
|
各位高手,我编的PASCAL三角形,编译的时候出错提示为: error C2601: 'combination' : local function definitions are illegal error C2601: 'factorial' : local function definitions are illegal fatal error C1004: unexpected end of file found 我实在找不出错的原因,请高手指点一下呀,谢谢。 /*pascal_triangle.cpp *the program display the pascal triangle. *********************************************/ #include #include using namespace std; /*function prototype*/ int combination(int n,int k); int factorial(int n); /*main function*/ void main() { cout<<"the program display the pascal triangle."; cout<<"How many lines do you want to generate? "; int i,j,k,line,outcome; cin>>line; for(i=0;i } for(k=0;k<=i;k++){ outcome=combination(i,k); cout< cout<<"\n"; } /*function:combination*/ int combination(int n,int k) { int result; result=factorial(n)/(factorial(k)*factorial(n-k)); return(result); } /*function:factorial*/ int factorial(int n) { int product=1,i; for(i=1;i<=n;i++){ product*=i; } return(product); } [ Last edited by formleaf on 2010-4-25 at 13:50 ] |
» 猜你喜欢
无聊看看时间戳打发时间
已经有3人回复
基于自然哲学类比的风化壳型稀土矿
已经有14人回复
国自然申请五篇代表作大比拼,感觉这个是最重要的
已经有7人回复
评委有多少概率知道其他专家手中有哪些人的本子?
已经有6人回复
求推荐期刊,重谢
已经有3人回复
职称论文投稿
已经有7人回复
中!中!中!
已经有4人回复
E0414, 我的本子有没有希望?
已经有17人回复
青A35岁以下通知答辩了吗
已经有4人回复
小城的小雨
已经有3人回复
» 本主题相关价值贴推荐,对您同样有帮助:
无机晶体求助解析
已经有5人回复
陨阳医学院临床医学专升本资料
已经有7人回复
(有机化学)求翻译~~金币嫌少可追加~~高手闲暇时光帮下忙哦~~~
已经有1人回复
请高手忙帮,关于细胞复苏的
已经有20人回复
发过 欧洲无机 的高手请帮下忙
已经有3人回复
【求助/交流】怎么做都提不出DNA,请高手帮一下忙喽!!!!
已经有52人回复
【求助】请教一下高手关于冻干的问题,大家帮下忙
已经有5人回复
【求助】XPS 高手请忙帮
已经有9人回复
Endnote于Word的问题
已经有2人回复
救助!翻译!
已经有14人回复
2楼2010-04-22 13:27:22
3楼2010-04-22 13:28:06
4楼2010-04-23 16:34:44
5楼2010-04-24 09:58:38
6楼2010-04-25 13:40:01
7楼2010-04-25 13:43:29
8楼2010-04-25 13:52:20











回复此楼