温度读数

时间:2016-05-14 06:35:05

标签: c

HELPPPPPP ......这是我的用户温度读数输入代码,但我真的不确定我的代码有什么问题。当我编译它时说“在'其他'之前预期表达”。我需要帮助,提前谢谢。

#include <stdio.h>

   main()
   {
   double lowest = 38;
   double temp;
   char bpower;

   printf("Enter temperature(C):");
   scanf("%lf", &temp);

   if(temp<lowest)
   {

     lowest = temp;

   }

     printf("Backup power on? (Y/N):");
     fflush(stdin);
     scanf("%c", &bpower);

    if(temp < 50);
    {

    printf("Normal mode of operation\n");
    printf("Continue to read the next temperature\n");

    }

    else

    {

       if(temp < 80)

       {
        printf("Turn on circulating fan\n");
        printf("Continue to read the next temperature\n");

       }


       else

       {
         if(bpower == 'N')   



        {
        printf("Turn off equipment\n");
        printf("Lowest temperature is %.2f", lowest);

        }

        else

        {  

         printf("Continue to read the next temperature\n");

         }

      }



 }
}

1 个答案:

答案 0 :(得分:2)

您的if个陈述中有一个迷路分号。改变这个:

if(temp < 50);
{

printf("Normal mode of operation\n");
printf("Continue to read the next temperature\n");

}

到此:

if(temp < 50)
{

printf("Normal mode of operation\n");
printf("Continue to read the next temperature\n");

}