帮忙看一下这个c语言程序哪不对 提示说是sqrt找不到标识符 运行环境vs2005

[复制链接]
查看11 | 回复5 | 2010-11-27 21:41:46 | 显示全部楼层 |阅读模式
#include "stdio.h"
#include "math.h"
#include "stdafx.h"
int dy(int a,int b,int c)
{
int x1,x2;
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
printf("x1=%d,x2=%d",x1,x2);
return 0;
}
int y(int a,int b,int c)
{
int x;
x=(-b)/(2*a);
printf("x=%d",x);
return 0;
}
int xy()
{
printf("not is shu");
}
int main()
{
int a,b,c;
printf("input a,b,c\n");
scanf("%d%d%d",&a,&b,&c);
if((b*b)-(4*a*c)>0)
dy(a,b,c);
else if((b*b)-(4*a*c)==0)
y(a,b,c);
else
xy();
return 0;
}

回复

使用道具 举报

千问 | 2010-11-27 21:41:46 | 显示全部楼层
先说明下”all:“和”clean:“。这两个语句类似于:if (arg=="all") then.... 和 if (arg=="clean") then...也就是说,如果你执行make all,all后面的语句就会被执行。如果make clean,clean后面的语句就会被执行。另外,all和clean后面的语句应该都是要缩进的。EXEC = hello// 生成的可执行文件名为helloOBJS = hello.o // 编译产生的中间文件名为hello.oCROSS= iwmmxt_le- //设置iwmmxt_Ie-为交叉编译环境CC = $(CROSS)gcc // 编译器是gccSTRIP= $(
回复

使用道具 举报

千问 | 2010-11-27 21:41:46 | 显示全部楼层
int xy() 要有返回值int dy(int a,int b,int c)函数的参数改成float或者 doublesqrt函数原型double sqrt(double x)#include "stdafx.h"这个头文件不能要 一般编译C语言还是VC6.0好用 操作简单 方便
回复

使用道具 举报

千问 | 2010-11-27 21:41:46 | 显示全部楼层
#include #include 不是""
回复

使用道具 举报

千问 | 2010-11-27 21:41:46 | 显示全部楼层
int型改成float或double型
回复

使用道具 举报

千问 | 2010-11-27 21:41:46 | 显示全部楼层
就这样xy(){printf(
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行