Advertisement
kklevi

prog1 féle

Jan 10th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4.  
  5. namespace ConsoleApp1
  6. {
  7.     class Program
  8.     {
  9.         static int[] StringToInt(string tmp)
  10.         {
  11.             string[] resultString = tmp.Split(' ');
  12.             int[] result = new int[resultString.Length];
  13.             for (int i = 0; i < resultString.Length; i++)
  14.             {
  15.                 result[i] = Convert.ToInt32(resultString[i]);
  16.             }
  17.             return result;
  18.         }
  19.  
  20.         static void Main(string[] args)
  21.         {
  22.             Console.WriteLine("Add meg szóközzel elválasztva, hogy hány kutyát, hány szempont szerint szeretnél értékelni. Pl. 8 5");
  23.             int[] elsoSor = StringToInt(Console.ReadLine());
  24.             int kutyaszam = Convert.ToInt32(elsoSor[0]);
  25.             int szempontokSzama = Convert.ToInt32(elsoSor[1]);
  26.            
  27.  
  28.             int[,] kutyakPontszamai = new int[kutyaszam,szempontokSzama];
  29.  
  30.             Console.WriteLine("Add meg a maximális pontszámokat! Annyi egész számot írj be, amennyi szempont szerint az első sorban értékelsz.");
  31.             int[] maxPontszamok = StringToInt(Console.ReadLine());
  32.             while(maxPontszamok.Length!=szempontokSzama)
  33.             {
  34.                 Console.WriteLine("Nem annyi számot írtál be, amennyi szempont van. Próbáld újra.");
  35.                 maxPontszamok = StringToInt(Console.ReadLine());
  36.             }
  37.  
  38.             Console.WriteLine("Add meg a minimális pontszámokat! Annyi egész számot írj be, amennyi szempont szerint az első sorban értékelsz.");
  39.             int[] minPontszamok = StringToInt(Console.ReadLine());
  40.             while (minPontszamok.Length != szempontokSzama)
  41.             {
  42.                 Console.WriteLine("Nem annyi számot írtál be, amennyi szempont van. Próbáld újra.");
  43.                 minPontszamok = StringToInt(Console.ReadLine());
  44.             }
  45.  
  46.             for (int i = 0; i < kutyakPontszamai.GetLength(0); i++)
  47.             {
  48.                 Console.WriteLine("Add meg a(z) {0}. kutya pontszámait szóközzel elválasztva", i+1);
  49.                 //itt azt kéne, hogy a kutyakPontszamai i-edik sorát feltöltse az adott pontszámokkal
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement