gpt4 book ai didi

c - 猜谜游戏 - 无法弄清楚为什么它会产生一个大的负整数

转载 作者:太空宇宙 更新时间:2023-11-03 23:38:39 24 4
gpt4 key购买 nike

<分区>

大家好。我在使用我生成的这段代码时遇到了问题。它运行一切正常,但是当我猜对它打印数字时,它会打印一个我不明白的数字,如 -3529583。阐明一些光?

#include <stdio.h>
#include <ctype.h>
#include <time.h>

int main()
{
int y, iRandomNum1; // Declare the three variables
y = 0;
iRandomNum1 = 0;
srand(time(NULL)); // Randomize function
iRandomNum1 = rand() % 10; // Randomize and collect 1 to 10 Value

while (iRandomNum1 != y) {
printf("Guess a number from 1 to 10\n");
scanf("%d", &y);
}
printf("\nCorrect Guess! Congrats! The answer is %d.\n", &y);
return 0;
}

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