Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Unsorted Parallel Arrays finding min & max values.
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string[] names = new string[] {"Professor X", "Iceman", "Angel", "Beast", "Phoenix", "Cyclops", "Wolverine", "Nightcrawler", "Storm", "Colossus"}; int[] numbers = new int[] { 7,9,12,15,17,13,2,6,8,13}; string result = ""; string mostwins = ""; string leastwins = ""; int highest = 0; int lowest = 1000; int indexofhigh = 0; int indexoflow = 0; int temphigh = 1; int templow ; for(int index = 0; index < numbers.Length; index++) { //Console.WriteLine("{0} with {1} wins ",names[index],numbers[index]); temphigh = numbers[index]; templow = numbers[index]; if(numbers[index] > highest) { highest = numbers[index]; indexofhigh = index; mostwins = names[index]; } if(numbers[index] < lowest) { lowest = numbers[index]; indexoflow = index; leastwins = names[index]; } } Console.WriteLine("{0} Battles won = {1} ",mostwins,highest); Console.WriteLine("{0} Battles won = {1} ",leastwins,lowest); } } }
run
|
edit
|
history
|
help
1
train555555
Event test
Fórum ➡ GroupJoin'ing Books and Orders ( with Zip'ped output ) ♦
852
array int
Testing 11
HashSet implementation
ffsfsfsfsfsferwfehtyjrvgjb
linked list reversal recursive
1