-1
私はC#の初心者です.2つの配列を並べ替え、ユーザーのカラー入力に基づいて最大の魚を見つけるプログラムを作成するという課題があります。私はそれを動作させる方法を知らない。誰かが私にいくつかの指針を与えることができますか?ここまで私がこれまで持っていたことがあります。配列を検索して最大のオブジェクトを見つけよう
Console.WriteLine("Select a fish color. \nEnter only the number.\n1.
Black\n2. Green\n3. Red\n4. Blue\n5. Yellow\nEnter Your Selection:");
string userColor = Console.ReadLine();
int value;
while (!(int.TryParse(userColor, out value) && value >=1 && value <=5))
{
Console.WriteLine("Please type only numbers from 1 to 5");
userColor = Console.ReadLine();
}
int color = int.Parse(userColor);
string[] colors = new string[] { "Black", "Black", "Green", "Red", "Blue", "Yellow", "Black", "Green", "Red", "Blue", "Yellow", "Black", "Green", "Red", "Blue","Yellow"};
double[] lenght = new double[] { 8.5, 9.8, 10.9, 40, 36, 45, 43, 12, 17.8, 13.5, 14.9, 27.7, 26.9, 50, 60,13 };
Console.WriteLine("You chose " + colors[color]);
Console.WriteLine("The biggest " + colors[color] + " fish is " + lenght[color]+ " inches long.");
解決策は簡単です。私はあなたの脳細胞をくすぐり、すばらしいスタックオーバーフローコミュニティの一部になるようにしてください。 ZIPはLinqの方法の1つです。 – Ramankingdom
https://msdn.microsoft.com/en-us/library/dd267698(v=vs.110).aspx – Ramankingdom