Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ExamPreparation
- {
- public sealed class Preparation
- {
- public static void Main()
- {
- string input = Console.ReadLine();
- Dictionary<string, double> resources = new Dictionary<string, double>();
- while (input != "stop")
- {
- double quantity = double.Parse(Console.ReadLine());
- if (resources.ContainsKey(input))
- {
- resources[input] += quantity;
- }
- else
- {
- resources.Add(input, quantity);
- }
- input = Console.ReadLine();
- }
- foreach (var resource in resources)
- {
- Console.WriteLine($"{resource.Key} -> {resource.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement