Software Engineering Second Job

Source: Internet
Author: User

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

Code implementation
#include <stdio.h> #include <time.h> #include <stdlib.h>int main () {    int a,i,n,o,x,y,z;    printf ("Please enter the number of questions:");    scanf ("%d", &n);   while (n--)    {        Srand (Time (NULL));  X=rand ()%10+1;  Y=rand ()%10+1;   O=rand ()%4;        Switch (o)     {case            0:       printf ("%d +%d =", x, y);  A=x+y;     break;          Case 1:                printf ("%d-%d =", x, y);  a=x-y;          break;         Case 2:          printf ("%d *%d =", x, y); A=x*y;      break;       Case 3:     printf ("%d/%d =", x, y);   a=x/y;                break;        }     scanf ("%d", &z); i=2;     while (z!=a&&i--)  {            printf ("Not correct! Try again!\n ");  scanf ("%d", &z);        }       if (z==a)  printf ("right!\n");    }    return 0;}

Program

Analysis and summary
    • Analysis

    • The foundation is too poor and needs to be strengthened

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.