(1) title for primary school students (respectively to +, -, *, present different operations), such as; (2) students to review it after to solve the problem; (3) students, after every do review it gives "the answer is correct, very good" or "the answer wrong, redo" and other words; (4) add, subtract, multiply, divide function can freely choose to implement; (5) can control numerical operations in two or within the scope of arithmetic (three digits),
CodePudding user response:
# include & lt; Ctime>//For the time () #include //For srand () and rand () #include #include
using namespace std;
Auto method () { Int v1=abs (rand () % 10-6);//add 0 1 multiply 2 divide 3 Return v1. }
Int main () { Srand (time (NULL));
While (true) { Int v2=rand () % 100 + rand () % 100;//double-digit triple-digit random number Int the v3=rand () % 100 + rand () % 100;//` ` If (method ()==0) { Int answer; Cout & lt; Cin & gt;> answer; If (answer==v2 and v3) {cout & lt; <"Correct answer" & lt; The else {cout & lt; <"Wrong answer" & lt; } Else if (method ()==1 & amp; & V2 & gt; V3) { Cout & lt; Int answer; Cin & gt;> answer; If (answer==v2, v3) {cout & lt; <"Correct answer" & lt; The else {cout & lt; <"Wrong answer" & lt; } Else if (method ()==2) { Cout & lt; Int answer; Cin & gt;> answer; If (answer==v2 * v3) {cout & lt; <"Correct answer" & lt; The else {cout & lt; <"Wrong answer" & lt; } Else if (method ()==3 & amp; & V2 & gt; V3) { Cout & lt; Int answer; Cin & gt;> answer; If (answer==v2/v3) {cout & lt; <"Correct answer" & lt; The else {cout & lt; <"Wrong answer" & lt; } The else { continue; } Sleep (300); } }
Thinking is the roughly, the rest of the need to adjust yourself looking at, is after all elementary school students?
CodePudding user response:
This is too good for my writing, https://blog.csdn.net/weixin_44119517/article/details/88883956
CodePudding user response:
A look at his code indentation 8 don't want to see it, I only accept the indentation 2 g ~ ~ ~