New Arithmetic Topic modification

Source: Internet
Author: User
Tags net time

program code;

#include <stdlib.h>
#include <iostream.h>
#include <conio.h>
#include <time.h>
using namespace Std;
void Display1 (Int,int,int);
void Display2 (int [],int,int,int);
int main ()
{
int a = 0;
int b = 0;
int mode = 0;//0: plus 1: minus 2: Multiply by 3: except
int i = 0;
int c[7]={0,40,1,100,1,1,4};//whether to customize, the number of question, whether there is multiplication, the upper limit, the lower value, whether the number of surplus, the number of each line.
Srand ((unsigned) time (NULL)); Initializes the random number generator so that the random number generated for each run is different
printf ("---------------------------------------------------------------------------\ n");
printf ("Welcome to the second pillar system!") \ n ");
printf ("The system by default generates 40 100 numbers within the arithmetic title, 4 lines per line \ n");
printf ("Are you customizing? is input 1, no input 0: ");
cin>>c[0];
if (c[0]==0)
{
printf ("----------------------------topic printed as follows------------------------------------\ n");
Display1 (A,b,mode);
}
Else
{
cout<< "Please enter the number of question:";
cin>>c[1];
cout<< "Does it contain multiplication? is input 1, no input 0: ";
cin>>c[2];
cout<< "Value upper limit:";
cin>>c[3];
cout<< "Lower value:";
cin>>c[4];
cout<< "Does it contain the remainder?" is input 1, no input 0: ";
cin>>c[5];
cout<< "Number of topics per line:";
cin>>c[6];
printf ("----------------------------topic printed as follows------------------------------------\ n");
Display2 (C,a,b,mode);
}
printf ("--------------------topic printed, thank you for using----------------------------------\ n");
cout<<endl;
return 0;
}
void Display1 (int a,int b,int mode)
{
for (int i=0;i<40;i++)//Do 30 questions
{
A = rand ()% 100; Generates a random number between 0~99
b = rand ()% 100; Generates a random number between 0~99
mode = rand ()% 4; Generates a random number between 0~3, which represents the operator
printf ("%d", a); Print calculation
switch (mode)//OK operator
{
Case 0:
printf ("+%d =", b);
Break
Case 1:
printf ("-%d =", b);
Break
Case 2:
printf ("*%d =", b);
Break
Case 3:
printf ("/%d =", b);
Break
Default
printf ("Somethingis wrong!\n");
Break
}
if ((i+1)%4== 0)//Determine if line wrapping
{
printf ("\ n");
}
Else
{

for (int j = 0;j<3;j++)
{
printf ("");
}
}
}
}
void Display2 (int c[],int a,int b,int mode)
{
for (int i=0;i<c[1];i++)//Custom problem number
{
A = rand ()% (c[3]-c[4]+1) +c[4]; Generate a qualified random number
b = rand ()% (c[3]-c[4]+1) +c[4]; Generate a qualified random number
if (c[2]==1)
{
mode = rand ()% 4; Generates a random number between 0~3, which represents the operator
switch (mode)//OK operator
{
Case 0:
printf ("%d+%d =", A, b);
Break
Case 1:
printf ("%d-%d =", A, b);
Break
Case 2:
printf ("%d*%d =", A, b);
Break
Case 3:
if (c[5] = = 1)//Select whether the surplus number, if can
{
printf ("%d/%d =", A, b);
}
else if (a%b!=0)//If the number of
{
i = i-1;
}
Else
{
printf ("%d/%d =", A, b);
}
Break
Default
printf ("Somethingis wrong!\n");
Break
}
if ((i+1)%c[6]== 0)//Determine if line wrapping
{
printf ("\ n");
}
Else
{

for (int j = 0;j<3;j++)
{
printf ("");
}
}
}
else{
mode = rand ()% 2; Generates a random number between 0~1, which represents the operator
printf ("%d", a); Print calculation
switch (mode)//OK operator
{
Case 0:
printf ("+%d = \ n", b);
Break
Case 1:
printf ("-%d = \ n", b);
Break
Default
printf ("Somethingis wrong!\n");
Break
}
if (i%c[6]== 0)//Determine if line wrapping
{
printf ("\ n");
}
Else
{

for (int j = 0;j<3;j++)
{
printf ("");
}
}
}
}
}

Run

First, the Project plan summary:

Weekly Activity Summary Table

Name: Kaikai Date: 15/3/14

Date Task

Lectures

Writing Programs

Read the textbook

Prepare for the exam

Total Day

Sunday

Monday

Tuesday

300

20

320

Wednesday

100

70

30

200

Thursday

200

115

5

320

Friday

200

40

30

270

Saturday

43

10

53

Week Summary

800

268

95

1163

Stage time and Efficiency week (week of last week activity table +1)

Cumulative time of previous weeks

Total

800

268

95

1163

Average

800

268

95

1163

Biggest

800

268

95

1163

Minimum

800

268

95

1163

Cumulative time excluding last week

Total

800

Average

Biggest

Minimum

Second, Time record table:

Student Kaikai date 15/13/14

Teacher Wang curriculum PSP

Date

Start time

End time

Interrupt Time

NET time

Activities

Note

3.11

14;00

15;00

30

30

Write code

3.11

21;00

22;00

0

60

Write code

3.12

19;10

21;00

20

100

Write code

3.13

15;00

16;00

0

60

Write code

3.13

20;30

22;00

30

90

Write code

3.14

15;12

18;00

72

120

Write code

Third, the defect record log:

Student

Date

teacher Wang

Program number

Date

Number

Type

Introduction phase

Exclusion phase

Repair time

Fixing defects

Due to the late arrival of the weekend, please forgive me.

New Arithmetic Topic modification

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.