| 查看: 540 | 回复: 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 ] |
» 猜你喜欢
材料求调剂 一志愿哈工大总分298分,前三科223分
已经有4人回复
086502化学工程342求调剂
已经有3人回复
求调剂
已经有9人回复
352分 化工与材料
已经有5人回复
085602 化工专硕 338分 求调剂
已经有10人回复
0856材料化工调剂 总分330
已经有10人回复
330一志愿中国海洋大学 化学工程 085602 有读博意愿 求调剂
已经有4人回复
一志愿哈尔滨工业大学材料与化工方向336分
已经有6人回复
材料求调剂一志愿哈工大324
已经有6人回复
085600 286分 材料求调剂
已经有4人回复
» 本主题相关价值贴推荐,对您同样有帮助:
无机晶体求助解析
已经有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














回复此楼