Array of initial knowledge
A network of deception lottery big secret
The following procedure is to be from Andy Lau "," Chow Yun-Fat "," Stephen Chow Chi "," Jay Chou "," Zhou Jie "," that English "," Liu Huan extract a person to obtain a prize, the normal lottery should be a way of procedure; improper
Lottery procedure (i) Fair procedure setting:
static void Main (string[] args)
{//Lottery program
String[] Xingming=new string[7]{"Andy Lau", "Chow Yun-Fat", "Stephen Chow Chi", "Jay Chou", "Zhou Jie", "The English", "Liu Huan"};//if you participate in the lottery to ensure your name here;
string[] Jiangpin = new string[6]{"Refrigerator", "mobile", "Computer", "House", "car", "Villa"};
Random a = new random ();
int b = A.next (xingming. Length);
Random c = new random ();
int d = C.next (Jiangpin. Length);
for (int i = 0; i < 7; i++)
{
Console.WriteLine (Xingming[i]); Here for loop only to set the screen display effect;
System.Threading.Thread.Sleep (500);//scroll to stay for 500 milliseconds;
Console.clear ();//rolling clear screen;
}
Console.WriteLine ("Congratulations" + xingming[b] + "get" + jiangpin[d] + "jackpot");//Here is the key position, set must be xingming[], so as to ensure the fairness of the lottery;
Lottery Program (ii) Set someone to get a prize
Lottery program
String[] Xingming=new string[7]{"Andy Lau", "Chow Yun-Fat", "Stephen Chow Chi", "Jay Chou", "Zhou Jie", "The English", "Liu Huan"};//if you participate in the lottery to ensure your name here;
string[] Jiangpin = new string[6]{"Refrigerator", "mobile", "Computer", "House", "car", "Villa"};
Random a = new random ();
int b = A.next (xingming. Length);
Random c = new random ();
int d = C.next (Jiangpin. Length);
for (int i = 0; i < 7; i++)
{
for (int j=0;j<6;j++)
Console.WriteLine (Xingming[i] + jiangpin[j]); Here for loop only to set the screen display effect;
System.Threading.Thread.Sleep (500);//scroll to stay for 500 milliseconds;
Console.clear ();//rolling clear screen;
}
Console.WriteLine ("Congratulations" + xingming[2] + "get" + jiangpin[5] + "jackpot");//Here is the key position, set must be xingming[], so as to ensure the fairness of the lottery;
If as above set no matter how to set the last output is Stephen Chow to get the villa;
Program (iii) set some people to win
Lottery program
String[] Xingming=new string[7]{"Andy Lau", "Chow Yun-Fat", "Stephen Chow Chi", "Jay Chou", "Zhou Jie", "The English", "Liu Huan"};//if you participate in the lottery to ensure your name here;
string[] Jiangpin = new string[6]{"Refrigerator", "mobile", "Computer", "House", "car", "Villa"};
Random a = new random ();
int B = A.next (3);//Make certain people win;
Random c = new random ();
int d = C.next (Jiangpin. Length);
for (int w = 1; w <= 2; w++)
{
for (int i = 0; i < 7; i++)
{
for (int j = 0; J < 6; J + +)
Console.WriteLine (Xingming[i] + jiangpin[j]); Here for loop only to set the screen display effect;
System.Threading.Thread.Sleep (500);//scroll to stay for 500 milliseconds;
Console.clear ();//rolling clear screen;
}
}
Console.WriteLine ("Congratulations" + xingming[b] + "get" + jiangpin[d] + "jackpot");//Here is the key position, set must be xingming[], so as to ensure the fairness of the lottery;
If as above set no matter how to set the last output is Stephen Chow to get the villa;
All of you do not believe that all kinds of online lottery, deceived the odds are very big!!
Two small automatic Statistics program
: Maximum value (relevant player) minimum (relevant player) sum;
Console.WriteLine ("Record player score");
int[] CJ = new INT[6];
for (int i = 0; i < CJ. Length; i++)
{
Console.WriteLine ("Please enter" + (i + 1) + "player's score");
Cj[i] = Convert.ToInt32 (Console.ReadLine ());
}
int min = 100000, max = 0, j = 0, z = 0, av = 0, h = CJ. Length, S = CJ. Length;
for (j = 0; J < CJ. Length; J + +)
{//Through this for, all values can be calculated
if (Cj[j] > Max)
{
max = Cj[j];
h = j;
}
if (Cj[j] < min)
{
min = Cj[j];
s = j;
}
Z = z + cj[j];
}
Console.WriteLine ("Max" + Max + "min" + min + "Total Score" + z + "average" + (Z/CJ). Length));
Console.WriteLine ("Player of the highest score" + (H + 1) + "player with the lowest score" + (s + 1));
Array of initial knowledge