Design arithmetic to include true fractions in the second-grade primary school operation

Source: Internet
Author: User

This time I added a true fractional operation based on the last arithmetic, and changed the arithmetic code on the basis of the previous

The code is as follows:

#include <stdio.h>#include<Windows.h>#include<time.h>voidMain () {intA, B, C, d,i,m,n; floatp, q;      Srand (Unsigned (Time (NULL)));  for(i =0; I < -; i++) {a= rand ()% -; b= rand ()% -; C= rand ()%5; Switch(c) { Case 0: printf ("%d +%d =\n", A, b);  Break;  Case 1:if(A <b) {d=A; A=b; b=D; } printf ("%d-%d =\n", A, b);  Break;  Case 2:p rintf ("%d *%d =\n", A, b);  Break;  Case 3:             while(b = =0) {b= rand ()% -; } printf ("%d/%d =\n", A, b);  Break;  Case 4: A= rand ()% -; b= rand ()% -; M= rand ()% -; N= rand ()% -; C= rand ()%4 ;  while(b = =0) {b= rand ()% -; }              while(n = =0) {n= rand ()% -; }             if(A >b) {d=A; A=b; b=D; }             if(M >N) {d=m; M=N; N=D; }             Switch(c) { Case 0:p rintf ("%d/%d +%d/%d =\n", A, B, M, n);  Break;  Case 1: P= (float) A/(float) b; Q= (float) m/(float) n; if(P <q) {d=A; A=m; M=D; D=b; b=N; N=D; } printf ("%d/%d-%d/%d =\n", A,b,m,n);  Break;  Case 2:p rintf ("%d/%d *%d/%d =\n", A, B, M, n);  Break;  Case 3: A= rand ()% -; b= rand ()% -; M= rand ()% -; N= rand ()% -; C= rand ()%4;  while(M = =0) {m= rand ()% -; } printf ("%d/%d/%d/%d =\n", A, B, M, n);  Break; }}} System ("Pause"); }

The results of the operation are as follows:

This experiment is a good learning experience, their own long a lot of ability, there is not a small receipt, their own course to learn more hard, day up, and hope that they can learn this course, their computer has been relatively unfamiliar, I hope this exercise can strengthen their knowledge of the computer, At the same time improve their ability to strengthen their own

Design arithmetic to include true fractions in the second-grade primary school operation

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.