The first algorithm, save a little bigger problem. Didn't find out.
Copy Code code as follows:
static void Main (string[] args)
{
//
TODO: Add code here to start the application
int singletitlemeasure=5;
int n=1;//declares an int variable that represents the test type
Random ran=new Random (Unchecked ((int) DateTime.Now.Ticks));
int int1random;
Switch (n)
{
Case 1://as single selection
{
int i=1,k=1;
Int[] **i=new int[singletitlemeasure+1];//declares an array to hold the title number
int temp;//declares an array that temporarily holds random values
Int1random=ran. Next (1,singletitlemeasure);
**i=int1random;
Console.WriteLine ("**i[" +i+ "]=" +**i);
Todo
{k=1; Int1random=ran. Next (1,singletitlemeasure); Temp=int1random; Console.WriteLine ("Temp:" +temp); do {if (Temp!=**i[k]) {
Console.WriteLine ("**i[" +k+ "]=" +**i[k));
k++;
Console.WriteLine ("Circular" + (k-1) + "Times");
}
Else
{
i--;
Console.WriteLine ("I=" +i); }}while (K<i); i++; **i=temp; Console.WriteLine ("**i[" +i+ "]=" +**i); }while (i<=singletitlemeasure-1); for (i = 1; I <=5; i++)
{Console.Write ("int1random="); Console.WriteLine (**i);
} break;
}
Case 2://expressed as multiple selection {Console.WriteLine ("int2random=");
}
Case 3://expressed as a judgment question
{
Console.WriteLine ("Int3random=");
Break
}
Default
{Console.WriteLine ("Invalid Selection"). Please select 1, 2, or 3. ");
}
Break
}
Console.read ();
}
Copy Code code as follows:
Using System;
Namespace Temp
{
<summary>
Summary description of the CLASS1.
</summary>
Class Class1
{
<summary>
The main entry point for the application.
</summary>
[STAThread]
static void Main (string[] args)
{
//
TODO: Add code here to start the application
int singletitlemeasure=20;//The number of questions in the item bank
Random number of an int int1random;//temporarily generated
Int[] **i=new int[singletitlemeasure+1];//declares an array to hold the title number
BOOL Bflag=true;
BOOL Bflag=true;
int n=1;//declares an int variable that represents the test type
int i=1;//declaration Outer Loop number
Switch (n)
{
Case 1://as single selection
{
Todo
{
Random ran=new Random (((int) DateTime.Now.Ticks)); The random number that's generated is a bit of a rule.
Random ran=new Random ((int) DateTime.Now.Millisecond);//This produces a random number more random Int1random=ran. Next (1,singletitlemeasure+1);
**i=int1random;
Console.WriteLine ("**i[" +i+ "]=" +**i);
Console.WriteLine ("Int1random=" +int1random);
int temp=int1random;
if (bflag==true)
{
**i=int1random;
Console.WriteLine ("**i[" +i+ "]=" +**i);
Bflag=false;
i++;
}
Else
{
Bflag=true;
int k=1;//Declaration Inner Loop number
Todo
{
if (Temp==**i[k])
{
Console.WriteLine ("**i[" +k+ "]=" +**i[k));
Bflag=false;
Break
}
k++;
}while (K<i);
if (bflag==true)
{
**i[k]=temp;
Console.WriteLine ("**i[" +i+ "]=" +**i);
i++;
}
}
}while (i<=5);
for (i=1;i<=5;i++)
{
Console.WriteLine ("**i[" +i+ "]=" +**i);
}
Break
}
Case 2://expressed as multiple selection
{
Console.WriteLine ("Int2random=");
Break
}
Case 3://expressed as a judgment question
{
Console.WriteLine ("Int3random=");
Break
}
Default
{
Console.WriteLine ("Invalid selection.") Please select 1, 2, or 3. ");
}
Break
}
Console.read ();
//
}
}
}