Topic:
Please write a "software" that can automatically generate primary arithmetic topics.
Allow the program to accept the user to enter the answer, and determine the right and wrong.
Finally, the total number of pairs/errors is given.
- can automatically generate add, subtract, multiply, divide arithmetic, and display in the console.
- The answers shown in the console are displayed and judged correctly or wrongly.
- Can count the total number of things to do and do wrong questions.
- After pressing any key, the input "1" for the addition operation, the input "2" for the subtraction operation, the input "3" for multiplication, the input "4" for the division operation;
- When the arbitrary choice of an operation will appear a corresponding topic, if the answer is not correct, will show "No,you is wrong!", if the answer is correct, will show "Yes,good job!" ;
- After completing a topic, enter "1" to continue to do the selected operation, enter "2" for the re-select operation, enter "3" then exit the operation;
- If you enter "2" in step 2nd, start the first step and enter 3 to exit the system if you do not have the problem, and count the total number of pairs/errors.
#include"stdio.h"#include"windows.h"intright=0, wrong=0;voidAdd () {intA,b,c; A=rand ()% -; b=rand ()% -; printf ("please answer:%d+%d=", A, b); scanf ("%d",&c); if(a+b!=c) {printf ("No,you is wrong!\n"); Wrong++; } Else{printf ("Yes,good job!\n"); Right++;} }voidMinu () {intA,b,c; A=rand ()% -; b=rand ()% -; printf ("please answer:%d-%d=", A, b); scanf ("%d",&c); if(a-b!=c) {printf ("No,you is wrong!\n"); Wrong++; } Else{printf ("Yes,good job!\n"); Right++; }}voidMul () {intA,b,c; A=rand ()% -; b=rand ()% -; printf ("please answer:%d*%d=", A, b); scanf ("%d",&c); if(a*b!=c) {printf ("No,you is wrong!\n"); Wrong++; } Else{printf ("Yes,good job!\n"); Right++; } }voiddi () {intA,b,c; A=rand ()% -; b=rand ()% -; printf ("please answer:%d/%d=", A, b); scanf ("%d",&c); if(a/b!=c) {printf ("No,you is wrong!\n"); Wrong++; } Else{printf ("Yes,good job!\n"); Right++; } }voidMain () {intchoise,con=0; printf ("\n\n\t\t Welcome to my C language four op \ n"); System ("Pause"); System ("CLS"); while(1) {printf ("\n\n\t\t Please select: \ n Plus (input 1) \ n minus (input 2) \ n (input 3) \ n (input 4) \ N"); if(con==0) scanf ("%d",&choise); Switch(choise) { Case 1: Add (); Break; Case 2: Minu (); Break; Case 3: Mul (); Break; Case 4:d I (); Break; } printf ("Would you like to continue with this operation or do you want to re-select another operation or exit the program? \ n Continue (enter 1), re-select operation (enter 2), exit (enter 3)"); scanf ("%d",&con); if(con==1) con=1; if(con==2) con=0; if(con==3) Break; } printf ("you always do%d questions, correct%d of the Tao, error%d! \ n", right+Wrong,right,wrong); System ("Pause");}
- PSP Time-consuming calculation
- Summary
First of all, because of the limited power, so the software has a lot of problems, when doing division operations do not come out.
Secondly, I think that for every thing, whether you like it or not, you have to have a good attitude when you do it, even if the result is not perfect, but at least there will be a result, if you do not do, even the result will not have.
Software Engineering Second Job