Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string product = input[0];
- double productPrice = double.Parse(input[1]);
- int productQuantity = int.Parse(input[2]);
- //проверка за ключа на главния речник
- if (!supermarketDatabases.ContainsKey(prouct))
- {
- supermarketDatabases.Add(product, new Dictionary<double, int>());
- }
- //проверка за ключа на вложения
- if(!supermarketDatabases[product].ConstainsKey(productPrice))
- {
- supermarketDatabases[product].Add(productPrice, 0);
- }
- //тук вече ти е другата логика (дали ще заместваш ст-ста или ще я събираш, изваждаш и т.н.),
- //другия вариант е на горния ред вместо 0 да ти е productQuantity, а този ред да ти е с else
- supermarketDatabases[product][productPrice] = productQuantity
Advertisement
Add Comment
Please, Sign In to add comment