标题:求函数的解(麻烦谁帮忙改一下)
取消只看楼主
wang6969772
Rank: 2
来 自:陕西西安
等 级:论坛游民
帖 子:11
专家分:10
注 册:2014-10-26
结帖率:25%
已结贴  问题点数:20 回复次数:0 
求函数的解(麻烦谁帮忙改一下)
#include<stdio.h>
#include<math.h>
float DaYu(int a,int b,int c);
float XiaoYu(int a,int b,int c);
float DengYu(int a,int b,int c);
int main()
{
    int m,n,l;
    float x1,x2,t,result;
    printf("qing shu ru m(m!=0),n,l:\n");
    scanf("%d,%d,%d",&m,&n,&l);
    t=n*n-4*m*n;
    if(t>0)
    {
        result=DaYu(m,n,l);
        printf("%.2f,%.2f",x1,x2);
    }
    else if(t<0)
    {
        result=XiaoYu(m,n,l);
        printf("wujie");
    }
    else
    {
        result=DengYu(m,n,l);
        printf("%.2f",x1);
   
    return 0;

}
float DaYu(int a,int b,int c)
{
    float x1,x2,t;
    x1=(-b+sqrt(t))/(2*a);
    x2=(-b-sqrt(t))/(2*a);
    return x1,x2;
}

float XiaoYu(int a,int b,int c)
{
    printf("wujie");
}
float DengYu(int a,int b,int c)
{
    float x1;
    x1=-b/2a;
}
错误:
test37.cpp
F:\c 源代码\test37\test37.cpp(12) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
F:\c 源代码\test37\test37.cpp(32) : error C2601: 'DaYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(40) : error C2601: 'XiaoYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(44) : error C2601: 'DengYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(46) : error C2059: syntax error : 'bad suffix on number'
F:\c 源代码\test37\test37.cpp(48) : fatal error C1004: unexpected end of file found
搜索更多相关主题的帖子: include result 
2014-12-07 12:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-439688-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.792226 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved