我在哪出错了?(C语言)

[复制链接]
查看11 | 回复3 | 2008-12-2 22:25:38 | 显示全部楼层 |阅读模式
#include "stdio.h"
int fone(int x)
{
int c,fone;
printf("please input the X:\n");
scanf("%d",&c);
fone=c*c*c;

}
main()
{
printf("the X3 is %d \n",fone(x));
}
请指点
主函数中还有错啊~~~~

回复

使用道具 举报

千问 | 2008-12-2 22:25:38 | 显示全部楼层
首先:主函数中的参数x没有定义其次:有返回值的函数需要加return修改之后如下:#include "stdio.h" int fone(int x) { int c=x;int fone; return fone=c*c*c; } main() { int x;printf("please input the X:\n"); scanf("%d",&x); printf("the X3 is %d \n",fone(x)); getch();}...
回复

使用道具 举报

千问 | 2008-12-2 22:25:38 | 显示全部楼层
/*程序小改了一下,可以运行出正确结果了,你对比一下吧*/#include "stdio.h" int fone(int x) { int fone;fone=x*x*x; return (fone);} main() { int x; printf("input x:\n"); scanf("%d...
回复

使用道具 举报

千问 | 2008-12-2 22:25:38 | 显示全部楼层
#include "stdio.h" int fone() { int c,fone; printf("please input the X:\n"); scanf("%d",&c); fone=c*c*c; return fone;} main() { printf("the X3 is %d \n",fon...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行