1. Bubble Sort Console.WriteLine ("to sort the numbers in a collection, enter the first number:"); intA =int. Parse (Console.ReadLine ()); Console.WriteLine ("to sort the numbers in the collection, enter a second number:"); intb =int. Parse (Console.ReadLine ()); Console.WriteLine ("to sort the numbers in the collection, enter a third number:"); intc =int. Parse (Console.ReadLine ()); Console.WriteLine ("to sort the numbers in a collection, enter the fourth number:"); intD =int. Parse (Console.ReadLine ()); Console.WriteLine ("to sort the numbers in a collection, enter the fifth number:"); intE =int. Parse (Console.ReadLine ()); intMID =0; List<int> iList =Newlist<int>(); Ilist.add (a); Ilist.add (b); Ilist.add (c); Ilist.add (d); Ilist.add (e); for(inti =0; i<ilist.count; i++) { for(intj = i +1; J < Ilist.count; J + +) { if(Ilist[i] <Ilist[j]) {Mid=Ilist[i]; Ilist[i]=Ilist[j]; ILIST[J]=mid; }}} Console.WriteLine ("the results after sorting are:"); foreach(intI1inchiList) {Console.Write (I1+" "); }2. Two sets of business cards: List collection: List<Object> list =NewList<object>(); List. ADD ("ID Number"); List. ADD ("Phone number"); List. ADD ("Sex"); List. ADD ("name"); List. ADD ("Height"); List. ADD ("Age"); List. ADD ("Weight"); List<Object> List1 =NewList<object>(); List1. ADD ("152103196312205230"); List1. ADD ("15998192408"); List1. ADD ("male"); List1. ADD ("Liu Xizhao"); List1. ADD ("172cm"); List1. ADD ("27 years old"); List1. ADD ("75kg"); while(true) {Console.Write ("Please enter the name you want to query:"); stringName =Console.ReadLine (); if(List1. Contains (name)) {foreach(Object objinchlist) {Console.Write (" "+ obj +" "); } Console.WriteLine (); foreach(Object obj1inchList1) {Console.Write (obj1+" "); } Console.WriteLine (); } Else{Console.WriteLine ("no such person ."); }arraylist Collection:///a different approachArrayList Card =NewArrayList (); Card.add (NewArrayList () {"220211100112209803","13618390284","male","Small Fat","178cm"," -","200kg" }); Card.add (NewArrayList () {"220211100112209803","13618390284","male","Shi","178cm"," -","200kg" }); Card.add (NewArrayList () {"220211100112209803","13618390284","male","Zhang San","178cm"," -","200kg" }); Card.add (NewArrayList () {"220211100112209803","13618390284","male","John Doe","178cm"," -","200kg" }); Card.add (NewArrayList () {"220211100112209803","13618390284","male","Lee","178cm"," -","200kg" }); Card.add (NewArrayList () {"220211100112209803","13618390284","male","Li Liu","178cm"," -","200kg" }); stringName =string. Empty; Console.WriteLine ("Please enter the name of the person you are looking for"); Name=Console.ReadLine (); for(inti =0; i < Card.count; i++) {ArrayList card=(ArrayList) card[i]; if(Card.) Contains (name) = =true) {Console.WriteLine (@"ID Number: {0}, phone number: {1}, Gender: {2}, Name: {3}, Height: {4}, Age: {5}, Weight: {6}", card[0], card[1], card[2], card[3], card[4], card[5], card[6]); Console.ReadLine (); } Else { Continue; } if(i = = Card.count-1) {Console.WriteLine ("Sorry, there is no one you are looking for! "); Console.WriteLine (" "); Console.readkey (); } }
C # Foundation Day three-job answer-collection-bubble sort-simulate business cards