Arithmetic Small problem analysis

Source: Internet
Author: User
Tags net time

Small topic arithmetic below is the source code

#include <iostream> using namespace std;

void Main () { int x0[1000],y0[1000],z0[1000],x1[1000],y1[1000],z1[1000],x2[1000],y2[1000],z2[1000],x3[1000], Y3[1000],z3[1000],a[1000],a,b,c;  int i,j,a0,a1,a2,a3,b0,b1,b2,b3;  int number1,number2,k;  int M,n;  int x, y, Z;  k=0;  A0=0; a1=0; a2=0; a3=0;  B0=0; b1=0; b2=0; b3=0;  cout<< "Arithmetic small topic" <<endl;  cout<<endl;    cout<< "Please enter the number of calculation questions and the number of topics displayed per line:" <<endl;  cin>>number1>>number2;    cout<< "Does it contain multiplication method?" is input 1, no please enter 0 "<<endl;  cin>>x;    cout<< is there a negative number for the inclusion of the add and subtract results? Yes Please enter 1, no please enter 0 "<<endl;  cin>>y;    cout<< "Is there any number of division results?" Yes Please enter 1, no please enter 0 "<<endl;  cin>>z;  cout<< "Please enter two values to determine the range of values for the parameters in the calculation (the previous parameter is less than the last one):" <<endl;  cin>>m>>n;  for (i=0;i<1000;i++)  {  X0[i]=0; y0[i]=0;   X1[i]=0; y1[i]=0;   X2[i]=0; y2[i]=0;   X3[i]=0; y3[i]=0;  }  for (i=0;; i++)  {  a=m+rand ()% (n-m);   b=m+rand ()% (n-m);   c=rand ()%4;   if (x==0)                  {   if (c==2| | c==3)     continue;   }   if (y==0)                  {   if (c==0)    {    if (a+b<0)       continue;    }    else if (c==1)    {    if (a-b<0)       continue;    }   }   if (z==0)                {   if (c==3)     if (0! = a%b)       continue;   }   if (c==0)                         {   for (j= 0;j<=a0;j++)    {    if (A==x0[j]&&b==y0[j])      {     B0++;break;     }    }     if (b0>0)    {    B0=0;continue;    }    else    {    X0[A0]=a;     Y0[A0]=b;      Z0[a0]=a+b;     A0++;    }   }   else if (c==1)                      {   for (j=0;j<=a1;j++)     {    if (a==x1[j]&&b==y1[j])     {      B1++;break;     }    }    if (b1>0)    {    B1=0;continue;     }    else    {    X1[A1]=a;     y1[a1 ]=b;     Z1[A1]=a+b;     A1++;    }   }   else if (c==2)                         {   for (j=0;j< =a2;j++)    {    if (A==x2[j]&&b==y2[j])     {      B2++;break;     }    }    if (b2>0)    {     B2=0;continue; &NBSP;&NBSP;&NBSP,    else    {    X2[A2]=a;      Y2[A2]=b;     Z2[A2]=a+b;     a2++;    }      else                                   {   if (b==0)     continue;    for (j=0; j<=a3;j++)    {    if (A==x3[j]&&b==y3[j])      {     B3++;break;     }    }    if (B3 >0)    {    B3=0;continue;    }    else     {    X3[A3]=a;     Y3[A3]=b;     z3[a3]= A+b;     A3++;    }   }   if (NUMBER1==A0+A1+A2+A3)                  &NBSP;&NBSP;&NBSp;break;  }  for (i=0;i<a0;i++)                           {  k++;   if (X0[i] <0)    cout<< "(" <<X0[i]<< ")";   else    cout<<X0[i]<< "";   cout<< "+";   if (y0[i]<0)    cout<< "(" <<Y0[i]<< ")";   else    cout<< "<<Y0[i]<<" ";   cout<< "=";   if (k%number2==0)    cout<<endl;   else    cout<< "\ t";  }     for (i=0;i<a1;i++)                            {  k++;   if (x1[i]<0)    cout<< "(" <<X1[i]<< ")";  else    cout<<X1[i]<< "";   cout<< "-";   if (y1[i]<0)    cout<< "(" <<Y1[i]<< ")";   else    cout<< "<<Y1[i]<<" ";   cout<< "=";   if (k%number2==0)    cout<<endl;   else    cout<< "\ t";  }  for (i=0;i<a2;i++)                            {  k++;   if ( x2[i]<0)    cout<< "(" <<X2[i]<< ")";   else    cout<<X2[i]<< "";   cout<< "*";   if (y2[i]<0)    cout<< "(" <<Y2[i]<< ")";   else    cout<< "<<Y2[i]<<" ";   cout<< "=";   if (K%number2==0)    cout<<endl;   else    cout<< "\ t";  }     for (i=0;i<a3;i++)                            {  k++;   if (x3[i]<0)    cout<< "(" <<X3[i]<< ")";   else    cout<<X3[i]<< "";   cout<< "/";   if (y3[i]<0)    cout<< "(" <<Y3[i]<< ")";   else    cout<< "<<Y3[i]<<" ";   cout<< "=";   if (k%number2==0)    cout<<endl;   else    cout<< "\ t"; &NBSP}  cout<< "Please enter a variety of results here:" <<endl;  for (i=0;i<number1;i++)   cin>>A[i];  int t=0,corr=0;  for (i=0;i<a0;i++)  {  if (Z0[i]==a[t])   {t++;corr++;}   else   {   t++;    cout<< "First" <<t<< "answer the wrong question! "<<endl;   }  }  for (i=0;i<a1;i++)  {  if (z1[i]==a[t])   {t++;corr++;}   else   {   t++;    cout<< "First" <<t<< "wrong answer!" "<<endl;   }  }  for (i=0;i<a2;i++)  {  if (z2[i]==a[t])   {t++;corr++;}   else   {   t++;    cout<< "First" <<t<< "wrong answer!" "<<endl;   }  }  for (i=0;i<a3;i++)  {  if (z3[i]==a[t])   {t++;corr++;}   else   {   t++;    cout<< "First" <<t<< "wrong answer!" "<<endl;   }    if (Number2==corr)   cout<< "Congratulations on your answer,!!!!!!. "<<endl;}

The first time to get this topic a bit of thinking, the feeling is not too clear, in fact, the actual list of detailed ideas is not so difficult, 1.1 points of change down the sense of thinking is very clear.

This program compared with the last program, just a few of the requirements of the topic, in fact, these with the previously learned knowledge can be completely resolved, so I feel as long as their own sense of the side is certainly not a problem, for the generation of random numbers and symbols are not explained in detail, and then I want to explain the topic.

The first is customizable, each line has several topics and each line has several topics that can be done using loops.

For repeated topics, the first generation of arrays, generating random numbers entered into the array, followed by a random number of comparisons, so into the array of numbers will not be repeated, the other there is no special idea, the feeling and the previous C + + almost.

Student: Liu Jian Date: 2015.3

Teacher: Wang course: Software engineering

Date

Start time

End time

Interrupt Time

NET time

Activities

Note

3/18

10 o'clock in the morning

11:30

Half an hour.

Listening songs, playing games

Study in the evening

3/19

4:30 P.M.

6:30 P.M.

20 minutes

Listen to the song

Arithmetic Small problem analysis

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.