故障错误解决

Trouble error solving

本文关键字:解决 错误 故障      更新时间:2023-10-16

我是这个网站的新手,也是编程新手。我在大学里上过一门编程课,老师给了我们一个代码来清除错误。我有这个困难,并希望一些帮助,提前感谢!我遇到的主要问题是"loop_counter"answers"FunctionFoo"身份不明和int loop_counter = 1;期待一个';'

#include "stdafx.h"
int UpdateWeatherStation(void)
{
    printf("Updating Weather Stationnn");
    int foo = 5;
    return foo;    
}
void main(void)
{
    printf("nTech104 Lab02nn")
    int loop_counter = 1; 
    int xyz = FunctionFoo();
    int hjk = FunctionFoo();
    while (loop_counter<10)
    {
        printf("Loop #:%dn", loop_counter);
        int weatherStatus = UpdateWeatherStation();
        printf("weatherStatus=%dn", weatherStatus);
        printf("nn");
        int user_input = getchar();
        if (user_input == '5')
        {
            printf("User entered 5!!!!!n");
        }
        loop_counter++;
    }
}
int FunctionFoo(void)
{
    printf("Hellonn");
    int abc = 5;
    return abc;
}

你的代码充满了错误:

1-函数FunctionFoo的原型在哪里?

2-在main中printf()之后,语句';'结束在哪里?

#include <stdio.h>
int FunctionFoo(void);
int UpdateWeatherStation(void);

void main(void)
{
    printf("nTech104 Lab02nn");
    int loop_counter = 1; 
    int xyz = FunctionFoo();
    int hjk = FunctionFoo();
    while (loop_counter<10)
    {
        printf("Loop #:%dn", loop_counter);
        int weatherStatus = UpdateWeatherStation();
        printf("weatherStatus=%dn", weatherStatus);
        printf("nn");
        int user_input = getchar();
        if (user_input == '5')
        {
            printf("User entered 5!!!!!n");
        }
        loop_counter++;
    }
}
int FunctionFoo(void)
{
    printf("Hellonn");
    int abc = 5;
    return abc;
}
int UpdateWeatherStation(void)
{
    printf("Updating Weather Stationnn");
    int foo = 5;
    return foo;    
}