错误:输入结束时的预期声明或声明

时间:2011-09-21 17:49:06

标签: c

嗨,我收到的错误是:

depthTemperature.c: In function 'main':
depthTemperature.c:29: error: expected declaration or statement at end of input
depthTemperature.c:29: error: expected declaration or statement at end of input

当我尝试编译并且我不确定为什么时,一切似乎对我来说都是犹太人,当然必定有一些我做错了。提前谢谢你的帮助。

#include <stdio.h>

void celsius_at_depth(double depth);
void fahrenheit(double celsius);

int
main(void)
{
    double depth;
    printf("Please input your depth to the nearest whole foot (eg. 100)> ");
    scanf("%lf", &depth);
    celsius_at_depth(depth);
    return 0;
{

void celsius_at_depth(double depth)
{
    double celsius;
    celsius=10*depth+20;
    printf("The temperature in celsius is: %f", celsius);
    fahrenheit(celsius);
}

void farenheit(double celsius)
{
    double farenheit;
    farenheit=1.8*celsius+32;
    printf("The temperature in farenheit is: %f", farenheit);
}

1 个答案:

答案 0 :(得分:10)

这不行:

int
main(void)
{
    return 0;
{
^ ???