gpt4 book ai didi

c++ - 我怎样才能重置我的程序? (不使用 goto)

转载 作者:行者123 更新时间:2023-11-30 01:47:57 26 4
gpt4 key购买 nike

<分区>

基本上我已经为我弟弟完成了一些乘法表测验的编程。我对编程很陌生,我不知道如何将我的程序重置回开始。任何人都可以阐明这一点吗?

#include <iostream>
#include <string>
#include <fstream>

using namespace std;
int main()
{
int sum ;
int question = 0;
int Uanswer ;
int score = 0;
int *score_pointer = &score;
//============================================================//
cout<<"= Hello Welcome to Your Times Tables ="<<endl;
cout<<"= Please Select A Table To Learn Below ="<<endl;
cout<<"========================================"<<endl;
cout<<"####################################"<<endl; /* THE MENU */
cout<<"####|1|2|3|4|5|6|7|8|9|10|11|12|####"<<endl;
cout<<"####################################"<<endl;
//============================================================//
cout<<">>:";
cin>> sum;
cout<<"You Selected "<< sum <<endl; /*User Input For Table */
cout<<"Time to Learn Brain Power Go!"<<endl;
//============================================================//
while (question <12){
question = question +1;
cout<< question;
cout<< "x";
cout<< sum ;
cout<< "=:";
cin>> Uanswer;
int Aanswer = (sum * question);

if (Aanswer == Uanswer){
cout<<"Correct: Well done Ben :)"<<endl;
*score_pointer = *score_pointer+1;
} else {
cout<<"Incorrect: Are you even trying? :("<<endl;
}
}

//====================================//
cout<<"Well done You scored " << score << " Out of 12"<<endl; /*Tally of total score */
//====================================//

return 0;
}

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