Using system; using system. collections. generic; using system. LINQ; using system. text; using system. collections; namespace consoleapplication2 {class program {// randomly add data between 1 and to the static void main (string [] ARGs) {arraylist arrlist = new arraylist (); // declare an array random ran = new random (); // define a pseudo-random number generator while (true) {// If the arrlist array contains more than 100 elements, the arrlist elements are output, and then the program (return) if (arrlist. count & gt; = 100) {Arrlist. sort (); // sort arrlist data in ascending order. foreach (INT s in arrlist) {console. write (S + "");} console. readkey (); return;} int random = ran. next (1,101); // returns a random number between 1 and if (! Arrlist. Contains (random) {arrlist. Add (random );}}}}}
Split the elements of the array by dividing lines
Namespace consoleapplication2 {class program {static void main (string [] ARGs) {// output you | I | his string [] arr = {"you", "I ", "He"}; string S = NULL; For (INT I = 0; I <arr. length; I ++) {if (I = arr. length-1) {S = S + arr [I];} else {S = S + arr [I] + "|" ;}} console. writeline (s); console. readkey ();}}}