如何解决错误:C中的预期标识符'('

问题描述 投票:1回答:1

我不了解自己在做什么,我已经搜索了多个在线参考资料,但仍然无法弄清楚自己在做什么错。这是我的代码

#include <cs50.h>
#include <stdio.h>

int x = 5;

int y=get_int("ENTER DIGIT HERE\n");

if (x>y) {
    printf("HI\n");

}else{
    printf("BYE\n");
} 
c
1个回答
2
投票

基本上是您想要的:

#include <cs50.h>
#include <stdio.h>

int main(void)   // <<<< your code must be in the main function
{
   int x = 5;

   int y=get_int("ENTER DIGIT HERE\n");

   if (x>y) {
     printf("HI\n");
   } else {
     printf("BYE\n")
   }
}
© www.soinside.com 2019 - 2024. All rights reserved.