Я новичок в этом сайте и новичок в программировании. Я беру урок по программированию в колледже, и нам дали код, чтобы очистить от ошибок. Я испытываю трудности с этим и хотел бы помочь, заранее спасибо! Основные проблемы, с которыми я сталкиваюсь, это то, что «loop_counter» и «FunctionFoo» неопознаны и int loop_counter = 1; ожидая ‘;’
#include "stdafx.h"
int UpdateWeatherStation(void)
{
printf("Updating Weather Station\n\n");
int foo = 5;
return foo;
}
void main(void)
{
printf("\nTech104 Lab02\n\n")
int loop_counter = 1;
int xyz = FunctionFoo();
int hjk = FunctionFoo();
while (loop_counter<10)
{
printf("Loop #:%d\n", loop_counter);
int weatherStatus = UpdateWeatherStation();
printf("weatherStatus=%d\n", weatherStatus);
printf("\n\n");
int user_input = getchar();
if (user_input == '5')
{
printf("User entered 5!!!!!\n");
}
loop_counter++;
}
}
int FunctionFoo(void)
{
printf("Hello\n\n");
int abc = 5;
return abc;
}
ваш код полон ошибок:
1 — где находится прототип функции FunctionFoo?
2- где конец утверждения ‘;’ после printf () в основном?
#include <stdio.h>
int FunctionFoo(void);
int UpdateWeatherStation(void);void main(void)
{
printf("\nTech104 Lab02\n\n");
int loop_counter = 1;
int xyz = FunctionFoo();
int hjk = FunctionFoo();
while (loop_counter<10)
{
printf("Loop #:%d\n", loop_counter);
int weatherStatus = UpdateWeatherStation();
printf("weatherStatus=%d\n", weatherStatus);
printf("\n\n");
int user_input = getchar();
if (user_input == '5')
{
printf("User entered 5!!!!!\n");
}
loop_counter++;
}
}
int FunctionFoo(void)
{
printf("Hello\n\n");
int abc = 5;
return abc;
}
int UpdateWeatherStation(void)
{
printf("Updating Weather Station\n\n");
int foo = 5;
return foo;
}
Других решений пока нет …