Software Engineering Second Job

Source: Internet
Author: User

#include <stdio.h> #include <stdlib.h> #include <time.h>int i=0,j=0;void Jia () {int A,b,m;srand (    NULL)); A=1+rand ()%100;    B=1+rand ()%100;    printf ("%d\n", a);    printf ("%d\n", b);    printf ("a+b=?\n");p rintf ("Please enter the result of the operation \ n"); scanf ("%d", &m), if (m==a+b) {printf ("Congratulations on your correct answer \ n"); i++;} else{printf ("You have the wrong answer \ n"); J + +;}}    void Jian () {int A,b,m;srand (time (NULL)); A=1+rand ()%100;    B=1+rand ()%100;if (a<b) {int t=0;t=a;a=b;b=t;}    printf ("%d\n", a);    printf ("%d\n", b);    printf ("a-b=?\n");p rintf ("Please enter the result of the operation \ n"); scanf ("%d", &m), if (m==a-b) {printf ("Congratulations on your correct answer \ n"); i++;} else{printf ("You have the wrong answer \ n"); J + +;}}    void Cheng () {int A,b,m;srand (time (NULL)); A=1+rand ()%20;    B=1+rand ()%20;    printf ("%d\n", a);    printf ("%d\n", b);    printf ("a*b=?\n");p rintf ("Please enter the result of the operation \ n"); scanf ("%d", &m), if (m==a*b) {printf ("Congratulations on your correct answer \ n"); i++;}        else{printf ("You have the wrong answer \ n"); j + +;}}    void Chu () {int A,b,m;srand (time (NULL));    A=1+rand ()%100; B=1+rand ()%100;if (b==0) {B=1+rand ()%100;} IF (a<b) {int t=0;t=a;a=b;b=t;}        while (a%b!=0) {A=1+rand ()%100;    B=1+rand ()%100;}    printf ("%d\n", a);    printf ("%d\n", b);    printf ("a/b=?\n");p rintf ("Please enter the result of the operation \ n"); scanf ("%d", &m), if (m==a/b) {printf ("Congratulations on your correct answer \ n"); i++;}        else{printf ("You have the wrong answer \ n"); j + +;}}
int main () {int M,n=0;while (1) {printf ("1. addition operation \ n");p rintf ("2. Subtraction operation \ n");p rintf ("3. multiplication \ n");p rintf ("4. Division operation \ n");p rintf ("Please select"); scanf ("%d", &m); switch (m) {case 1:jia (); break;case 2:jian (); break;case 3:cheng (); break;case 4:chu (); break;} printf ("5. Please re-select \ n");p rintf ("6. End \ n"); scanf ("%d", &n); if (n==6) break;} printf ("You answer the total number%d and the correct number of%d\n", i+j,i); return 0;}
The above is the test process.

Software Engineering Second Job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.