gpt4 book ai didi

c - 程序没有显示错误,但无法编译。你能帮我解决我需要做的事情吗

转载 作者:行者123 更新时间:2023-11-30 20:09:26 25 4
gpt4 key购买 nike

程序没有显示错误,但无法编译。您能帮我解决这个问题吗?

int main(void) {
printf("\n*************************************************************\n");
printf("\n*************************************************************\n");
printf("\n******** Program find the solution to which car you *********\n");
printf("\n******* could still earn if you received A's for the ********\n");
printf("\n********* remainder of your undergraduate classes. **********\n");
printf("\n*************************************************************\n");
printf("\n*************************************************************\n");
printf("\n You will be asked to enter your current GPA with at most 3 \n");
printf("\n Decimal places and the number of credit hours that the GPA \n");
printf("\n Was based on, which should be a positive number. \n");
printf("\n And the honors you qualify for will be displayed to screen.\n");
printf("\n*************************************************************\n");
printf("\n*************************************************************\n");

printf("\nPlease enter your current GPA with at most 3 decimal places.\n");
printf("\nFor example, for a GPA of 2.3333333333, enter 2.333\n");
printf("\nThis GPA should fall between 0 and 4.0 --> ");
scanf("%d, &numb1\n");
printf("\n*************************************************************\n");

printf("\nPlease enter the number of credit hours that this GPA was based");
printf("\n on. This should be a positive integer\n");
printf("\nFor example, for twelve credit hours, simple enter 12.\n");
printf("\n-->");
scanf("%d, &numb2");
printf("***************************************************************\n");
}

最佳答案

由于双引号的放置位置,您将向 scanf 传递一个参数。

应该是:scanf("%f", &numb1);scanf("%d", &numb2);

请注意,numb1%f,因为它是 float ,numb2%d(对于整数)。

此外,您从未声明过变量 numb1numb2,因此您还需要: float numb1; int numb2; 位于函数顶部。

关于c - 程序没有显示错误,但无法编译。你能帮我解决我需要做的事情吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52320536/

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