Software Engineering Job Submission 3.06

Source: Internet
Author: User

Topic:

Write a program that can output 30 random arithmetic elementary School second grade topic

Design ideas:

  A random function is used to generate two two-digit numbers, and four operators are randomly selected using random numbers, and are used to cycle 30 times and output

Source code (VC software):

 

#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
int RAK ()
{
return rand ()/327; Set a random number within 100
}
void Main ()
{
Char a[4]={' + ', '-', ' * ', '/'};
int x;
for (int i=1;i<31;i++)
{
Cout<<rak ();
X=rand ()%4;
cout<<a[x];
if (x==3)//exclude divisor is 0 error
{
while (1)
{
if (RAK ()!=1)
{
Cout<<rak ();
Break
}
}
}
Else
{
Cout<<rak ();
}
cout<< "=" <<endl;
}
}

Experimental results:

Reasons for Unfinished class:

In fact, I was finished in class, but also spent a little more time than expected, mainly because not often use vs software to write C language, generally use VC software, followed by the name of the random function, and then think of it.

Software Engineering Job Submission 3.06

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.