|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include<stdio.h>
- double fun(int m)
- {
- double y=1;
- int i;
- for(i=3;i<m;i++)
- y+=1.0/(2*i-3);
-
- return(y);
- }
- void main(void)
- {
- int n;
- clscr();
- printf("Enter n:");
- scanf("%d",&n);
- printf("\nThe result is %lf\n",fun(n));
- getch();
- }
复制代码
correct:for(i=3;i<=m;i++)or for(i=3;i<m+1;i++)
Q1:为什么main 只能返回int
15 15 [Error] '::main' must return 'int'
Q2:main函数未命名的怎么搞;百度查到clscr()只在TC里有,其它的编译器中不支持,TC又是啥没查到;知道getchar,getch是印刷错误吗?
19 8 [Error] 'clscr' was not declared in this scope
23 8 [Error] 'getch' was not declared in this scope |
|