【发布时间】:2016-10-18 02:46:20
【问题描述】:
嘿,我迷失了为什么这个循环不起作用,这一切似乎都是正确的,但是 while 内没有任何东西可以工作,如果你需要它们,请帮助其余的代码在其他文件中,我可以发布它们
#include <stdio.h>
#include "weatherstation.h"
int dunits = METRIC;
void main(void)
{
char test;
InitializeWeatherStation();
while(1);
{
UpdateWeatherStation();
printf("Enter m for Metric units, b for British units, or q to quit");
scanf_s("%c",&test);
if(test == 'm')
{
dunits = METRIC;
}
else if(test == 'b')
{
dunits = BRITISH;
}
else if(test == 'q')
{
return;
}
DisplayWeatherData(dunits);
}
}
【问题讨论】:
-
你的代码does not work?
标签: c loops while-loop infinite-loop