usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceconsoleapplication10{classProgram {Static voidMain (string[] args) {Random ran=NewRandom (); for (; ; ) { stringAA ="", BB =""; for(intL =1; L <=4; l++) { intb = ran. Next ( $); string[] C =New string[ $] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q", "R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7" ,"8","9","0"}; AA=C[b]; BB+=AA; } Console.WriteLine ("The verification code is:"+BB); Console.Write ("Please enter a verification code"); stringMa =Console.ReadLine (); Ma=Ma. ToUpper (); if(MA = =BB) {Console.WriteLine ("verification code entered correctly"); Break; } Else{Console.WriteLine ("input Error Please re-enter"); } console.readline (); } } } }
5.20 C # Verification Code practice