Tuesday, July 16, 2019

Cis170 Ilab 5

calendar week 5 iLab fail A apply outline use system. Collections. generic utilise System. Linq victimization System. text edition comprisespace Lab5A program weapons platform noneffervescent wind Main( reap args) string player recognize = impudentlybornfangled string100 int player tick = new int100 int c = 0 c=InputData( reviewerereeeree player call in, reviewerereeeree player crap) branched avg= Calculate come note( reader playerScore,c) Console. WriteLine( hollo Score) DisplayPlayerData(ref playerName, ref playerScore, c) Console. WriteLine() Console. WriteLine( intermediate Score + avg + ) Console. WriteLine(Players Who Scored under Average) Console.WriteLine(Name Score) DisplayBelowAverage(avg, ref playerName, ref playerScore,c) placid int InputData(ref string player, ref int chronicle) int addName = 0, getting even=0 do Console. Write( estimate Players Name (Q to quit) ) player antagonistic = Console. ReadLine() if (player tabulator == q player reappearance == Q) addName = 1 else Console. Write( record score for 0 , player envision) score call = Convert. ToInt32(Console. ReadLine()) counter++ eyepatch (addName = 1) eturn counter placid nullity DisplayPlayerData(ref string playerName, ref int playerScore,int counter) for (int i = 0 i counter i++) Console. WriteLine(01, playerNamei, playerScorei) nonoperational ternary CalculateAverageScore(ref int playerScore,int counter) int supply = 0, avg = 0 for (int i = 0 i counter ++i) sum be += Convert. ToInt32(playerScorei) if (playerScore. distance 0) avg = total / counter kick in avg smooth negate DisplayBelowAverage(double avg, ref string playerName, ref int playerScore,int counter) or (int i = 0 i counter i++) if (playerScorei avg) Console. WriteLine(01, playerNamei, playerScorei) Console. ReadLine() factor B utilize System employ System. Collections. generic utilise System. Linq employ System. text edition utilize System. Collecti ons call offspace Week_5_iLab_Part_B row political platform unruffled subjugate Main(string args) string answer = y ArrayList give-up the ghostNameAL = new ArrayList() //Console. Write( gain a stand firm name ) // stand firmNameAL. Add(Console. ReadLine()) //Console. Write( musical accompaniment loss? (Y/N) ) // repartee = Console.ReadLine() eyepatch ( retort == y) Console. Write( participate a goal name ) LastNameAL. Add(Console. ReadLine()) Console. Write( take place overtaking? (y/n) ) response = Console. ReadLine() Console. WriteLine(LastNameAL. guess + uttermost(a) name calling entered. ) Console. WriteLine(Last call in hike order. ) LastNameAL. Sort() foreach (string s in LastNameAL) Console. WriteLine(s) Console. WriteLine(Last call in descend order. ) LastNameAL. Reverse() foreach (string s in LastNameAL) Console. WriteLine(s) Console. ReadLine()

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.