BubaLazi

MultiDict01Average Student Grades test

Aug 3rd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MultiDictionaries
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var studentsGrades = new Dictionary<string, List<double>>();
  14.             double inputCount = double.Parse(Console.ReadLine());
  15.  
  16.             for(int i = 0; i < inputCount; i++)
  17.             {
  18.                 string[] input = Console.ReadLine().Split(' ');
  19.                 string name = input[0];
  20.                 double grade = double.Parse(input[1]);
  21.                 int count = 0;
  22.                 double[] average = ;
  23.  
  24.                 if(!studentsGrades.ContainsKey(name))
  25.                 {
  26.                     studentsGrades.Add(name,new List<double>());
  27.                 }
  28.                 studentsGrades[name].Add(grade);
  29.  
  30.  
  31.             }
  32.            
  33.             foreach(KeyValuePair<string, List<double>> record in studentsGrades)
  34.             {
  35.                 string name = record.Key;
  36.                 List<double> grades = record.Value;
  37.  
  38.  
  39.                 Console.WriteLine("{0} -> {1}", name, string.Join(" ", grades));
  40.             }
  41.  
  42.  
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment