gpt4 book ai didi

java - 如何得分然后将它们全部加起来

转载 作者:行者123 更新时间:2023-11-29 05:24:33 25 4
gpt4 key购买 nike

我做了一个代码女巫问你问题,每答对一个问题都会加一分,问题是我想知道如何显示你的分数。比如你总共有多少分。

System.out.println("#1: What is 8+8?");
answer=in.nextInt();
if (answer == 16)
System.out.println("Correct!");
else
System.out.println("Incorrect!");
if (answer == 16)
points =+ 1;

这是一个示例,表明如果“答案”正确,它将 +1 分。我想当它告诉你你有多少分是正确的。示例:“正确!您现在有“分”分!如果你需要的话,这是我的整数

int points;
int answer2;
int answer;

到目前为止我只有 2 个问题,因为我正在等待这个解决方案。

最佳答案

System.out.println("Correct! You now have "+points+" points!");

关于java - 如何得分然后将它们全部加起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23188765/

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