Although the holiday before the girls to the same dorm to get the software to my USB flash drive, but the results are not installed on the home, so just in the Notepad code. The result can not run actually I do not know, just put some code to send up.
Here's my Code.
namespace add
{
Class Program
{
static void Main (string[] args)
{
int right=0;
int wrong=0;
Do
{
Random sj=new random ();
int X=SJ. Next (0,11);
int Y=SJ. Next (1,3);
Console.WriteLine ("Please select an operation +,-, *,/; or press ENTER to end the process");
String i=convert.tostring (Console.ReadLine ());
if (i = = "+")
{
Console.WriteLine ("{0}+{1}=", x, y);
int Z=conver.toint32 (Console.ReadLine ());
if (z = = x + y)
{
right++;
}
Else
{
Console.WriteLine ("Sorry, answer wrong!") ");
wrong++;
}
}
Else
if (i = = "-")
{
Console.WriteLine ("{0}-{1}=", x, y);
int Z=conver.toint32 (Console.ReadLine ());
int (z ==x-y)
{
right++;
}
Else
{
Console.WriteLine ("Sorry, answer wrong!") ");
wrong++;
}
}
Else
if (i = = "*")
{
Console.WriteLine ("{0}*{1}=", x, y);
int Z=conver.toint32 (Console.ReadLine ());
if (z = = x * y)
{
right++;
}
Else
{
Console.WriteLine ("Sorry, answer wrong!") ");
wrong++;
}
}
Else
if (i = = "/")
{
Console.WriteLine ("{0}/{1}=", x, y);
int z = conver.toint32 (Console.ReadLine ());
if (z = = x/y)
{
right++;
}
Else
{
Console.WriteLine ("Sorry, answer wrong!") ");
wrong++;
}
}
}
while (Console.ReadLine ()! = "P");
Console.WriteLine ("You answered {0}, correct: {1}, Error: {2}", Right+wrong,right,wrong);
Console.ReadLine ();
}
}
}
This is my code, I go back to school tomorrow will run first, if not successful, I will improve again.
Third assignment: random arithmetic of 0~10