EASY C ++(函数调用)

时间:2014-01-09 21:48:20

标签: c function call

这个程序给了我错误的答案,比如-88567.0000000000000我不知道什么是错的

#include<stdio.h>
#include<math.h>

main()
{
    float voltage,current,result;

    puts("hello please enter the voltage  ");
    scanf("%f",&voltage);

    puts("\nhello please enter the current  ");
    scanf("%f",&current);

    result=calling(voltage,current);
    // result from function calling 
    printf("the answer is %f",result);      // display the result 
    getch();
}

    float  calling (float y,float x)
    {
        float ans;
        ans=y+x;
        return(ans);
    }

1 个答案:

答案 0 :(得分:1)

放原型

float  calling (float y,float x);

在主

之前