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;
- using System.IO;
- namespace boltehazinak
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, int> termekekEsArak = new Dictionary<string, int>();
- Console.Write("Add meg, hogy hány eladás volt ma: ");
- int hanyEladas = int.Parse(Console.ReadLine());
- for (int i = 0; i < hanyEladas; i++) {
- Console.Write("Add meg a termék árát: ");
- int termekAra = int.Parse(Console.ReadLine());
- Console.Write("Add meg a termék nevét: ");
- string termekNeve = Console.ReadLine();
- termekekEsArak.Add(termekNeve, termekAra);
- }
- var kiiratoVegleges = new List<string>();
- kiiratoVegleges.Add($"{DateTime.Now.Year}. {DateTime.Now.Month}. {DateTime.Now.Day} napi eladások ({hanyEladas} db)");
- foreach (var t in termekekEsArak) {
- kiiratoVegleges.Add($"{t.Key}: {t.Value}");
- }
- File.WriteAllLines("eladasok.txt", kiiratoVegleges);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment