C语言寻求帮助。。。

[复制链接]
查看11 | 回复4 | 2011-3-17 05:30:00 | 显示全部楼层 |阅读模式
stdio.h>int Factorial(int n){ if (n>1) {return n*Factorial(n-1); }else return 1;}int main(){ int n=0; double e=0; int FacTmp=0; double InvFacTmp=1; double expt=0.0001; int i,j;/* using for*/ for (n=0;InvFacTmp>expt;n++) {FacTmp=Factorial(n);InvFacTmp=1.0/FacTmp;e...
回复

使用道具 举报

千问 | 2011-3-17 05:30:00 | 显示全部楼层
上面三处错误:1.void main();错在“;”main()函数后面不能有“;” 2.
char c='c';
// 字符用' '
字符串用""
3.
printf("%d\n",int(f%3)); 错在int(f%3)强制转换不是这么写的因该是:(int)f%3...
回复

使用道具 举报

千问 | 2011-3-17 05:30:00 | 显示全部楼层
#includevoid main()
//多个 分号 {
float f=7.12;
char c='c';
// 字符用' '
字符串用""
printf("%d\n",int(f/3)); //% 不能用于 float 类型
printf("...
回复

使用道具 举报

千问 | 2011-3-17 05:30:00 | 显示全部楼层
; long sushu(n);//////////有问题吧,n没初始化就用去做参数了 for(n=3;nint main(){
float f=7.12;
char c='c';
printf("%d\n",int(f)%3);
printf("%c",c);
return 0;}...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行