| 查看: 463 | 回复: 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 ] |
» 猜你喜欢
基金申报
已经有5人回复
基金委咋了?2026年的指南还没有出来?
已经有7人回复
国自然申请面上模板最新2026版出了吗?
已经有17人回复
纳米粒子粒径的测量
已经有8人回复
疑惑?
已经有5人回复
计算机、0854电子信息(085401-058412)调剂
已经有5人回复
Materials Today Chemistry审稿周期
已经有5人回复
溴的反应液脱色
已经有7人回复
推荐一本书
已经有12人回复
常年博士招收(双一流,工科)
已经有4人回复
» 本主题相关价值贴推荐,对您同样有帮助:
无机晶体求助解析
已经有5人回复
陨阳医学院临床医学专升本资料
已经有7人回复
(有机化学)求翻译~~金币嫌少可追加~~高手闲暇时光帮下忙哦~~~
已经有1人回复
请高手忙帮,关于细胞复苏的
已经有20人回复
发过 欧洲无机 的高手请帮下忙
已经有3人回复
【求助/交流】怎么做都提不出DNA,请高手帮一下忙喽!!!!
已经有52人回复
【求助】请教一下高手关于冻干的问题,大家帮下忙
已经有5人回复
【求助】XPS 高手请忙帮
已经有9人回复
Endnote于Word的问题
已经有2人回复
救助!翻译!
已经有14人回复
5楼2010-04-24 09:58:38
2楼2010-04-22 13:27:22
3楼2010-04-22 13:28:06
4楼2010-04-23 16:34:44











回复此楼