c语言程序不能运行,帮我修改一下,我是初学者

来源:百度知道 编辑:UC知道 时间:2024/05/31 04:13:03
void main()
{int temperature,weather;
printf("Please input one temperature:);
scanf("%f",&temperature);
if(temperature>=0)
printf("%f can cause rainy",weather);
else
printf(%f can cause snowy",weather);
}
能帮忙改下我的程序吗,谢谢哦

#include <stdio.h>

void main()
{
/* int temperature,weather; */
float temperature;
printf("Please input one temperature:");
scanf("%f",&temperature);
if(temperature>=0)
printf("%f can cause rainy\n",temperature);
else
printf("%f can cause snowy\n",temperature);
}

你的weather没有赋值怎么输出。。。
还有你有的冒号没有标全

void main()
{int temperature,weather;
printf("Please input one temperature:");
scanf("%f",&temperature);
if(temperature>=0)
printf("%d can cause rainy",weather);
else
printf("%d can cause snowy",weather);
;
}

你的weather变量没有初始值,要输出的话肯定运行不过去啊。
最后一条printf语句的引号少了一个。
include<iostream.h>
void main()
{
int temperature;
printf("Please input one temperature:);
scanf("%f",&temperature);
if(temperatur