gpt4 book ai didi

c - 收到错误 : expected identifier or ‘(’ before ‘{’ token

转载 作者:太空宇宙 更新时间:2023-11-04 05:07:16 25 4
gpt4 key购买 nike

<分区>

出现此错误:在 int main 之前的 #include 之后的第一个括号中,预期标识符或“{”标记之前的“(” >。不知道为什么!正在为介绍性编程类(class)做作业。今天到期,如有任何帮助,我们将不胜感激!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
{
int main(void);

int cardNum(int firstCard, int secondCard;
int highLow;
int score;

score = 0;
srand(time(NULL));

printf("The current card is a %d\n" ,firstCard(2,14));
printf("\n Will the next card be higher(1) or lower(2)? (press 0 to quit)");
scanf("%d" ,highLow);
if cardNum > 1 && cardNum < 11
{
printf ("The card is: %d ,secondCard.");
}
else if cardNum == 11
{
if highLow == 1, && secondCard > firstCard OR highLow == 2, && secondCard < firstCard
{
score = score + 1;
printf ("\n You have guessed correctly.");
printf ("\n Your current score is %d ,score!\n");
printf("The current card is a ("%d" ,cardOne). \n Will the next card be higher(1) or lower(2)? (press 0 to quit)");
}
else if highLow == 1, && secondCard < firstCard OR highLow == 2, && secondCard > firstCard
{
score = score - 1;
printf ("The card is: %d ,secondCard.");
printf ("\n You have guessed incorrectly.");
printf ("\n Your current score is %d ,score!\n");
printf ("The current card is a %d ,cardOne.");
printf ("\n Will the next card be higher(1) or lower(2)? (press 0 to quit)");
}
else if secondCard == firstCard
{
printf ("\n Matching cards, no change in score");
}
else if highLow == 0
{
printf ("\n Thanks for playing! Your final score is %d, score.");
}
else
{
printf ("\n Incorrect input. Please enter 0, 1 or 2")
}
}
return(0);
}

我最初使用 int main(void){ 时遇到了这样的问题,但后来我得到了所有这些错误,所以我将其更改为分号并且只得到了一个错误。
a3.c:在函数“main”中:a3.c:24:5: 错误:预期的声明说明符或“分数”之前的“...”a3.c:25:5: 错误:预期的声明说明符或‘srand’之前的‘...’a3.c:27:5: 错误:预期的声明说明符或“...”在“printf”之前a3.c:28:5: 错误:在‘printf’之前需要声明说明符或‘...’a3.c:29:5: 错误:在‘scanf’之前需要声明说明符或‘...’a3.c:31:5: 错误:预期的声明说明符或“...”在“if”之前a3.c:82:1: 错误:预期声明说明符或“}”标记前的“...”a3.c:82:1: 错误:'}' 标记前需要';'、',' 或')'a3.c:82:1: 错误:输入末尾需要声明或语句a3.c:82:1: 警告:控制到达非空函数的结尾 [-Wreturn-type]

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com