Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace testtttt
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- List<Products> listOfProducts = new List<Products>();
- List<Order> orders = new List<Order>();
- for (int i = 0; i < n; i++)
- {
- string[] input = Console.ReadLine().Split('-').ToArray();
- var product = new Products
- {
- Name = input[0],
- Price = decimal.Parse(input[1])
- };
- var product2 = listOfProducts.FirstOrDefault(x => x.Name == product.Name);
- if (product2 == null)
- {
- listOfProducts.Add(product);
- }
- else
- {
- product2.Price = product.Price;
- }
- }
- string inputLine = Console.ReadLine();
- while (inputLine != "end of clients")
- {
- string[] orderData = inputLine.Split('-', ',').ToArray();
- var checkOrder = listOfProducts.FirstOrDefault(x => x.Name == orderData[1]);
- if (checkOrder != null)
- {
- var order = new Order();
- if (order.Bill[)
- {
- }
- }
- inputLine = Console.ReadLine();
- }
- foreach (var item in orders.OrderBy(x => x.Name))
- {
- Console.WriteLine(item.Name);
- }
- }
- }
- class Products
- {
- public string Name { get; set; }
- public decimal Price { get; set; }
- }
- class Order
- {
- public string Name { get; set; }
- public Dictionary<Products, int> Bill { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement