Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 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. using System.IO;
  7.  
  8. namespace ConsoleApp16
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15. string path = @"C:\Users\pclab\Desktop\mitsos" + 2 + ".txt";
  16. List<string> names = new List<string>() { "Hector", "Basilis", "Mixalis" };
  17. List<string> surnames = new List<string>() { "Gatsos", "Paspas", "Taspsa" };
  18. List<string> salaries = new List<string>() { "50000", "3000", "4000" };
  19. List<string> ages = new List<string>() { "33", "9", "65" };
  20. List<string> content = new List<string>();
  21.  
  22.  
  23. Console.WriteLine("Dose onoma");
  24. string name = Console.ReadLine();
  25. names.Add(name);
  26.  
  27.  
  28. Console.WriteLine("Dose epitheto");
  29. string epitheto = Console.ReadLine();
  30. surnames.Add(epitheto);
  31.  
  32. Console.WriteLine("Dose salary");
  33. string salary = Console.ReadLine();
  34. salaries.Add(salary);
  35.  
  36. Console.WriteLine("Dose age");
  37. string age = Console.ReadLine();
  38. ages.Add(age);
  39.  
  40.  
  41.  
  42.  
  43.  
  44. for (int i = 0; i < names.Count; i++)
  45. {
  46. var str = string.Join(",", names[i], surnames[i], salaries[i], ages[i]);
  47. content.Add(str);
  48. }
  49.  
  50.  
  51. foreach (var item in content)
  52. {
  53. Console.WriteLine(item);
  54. }
  55.  
  56. File.WriteAllLines(path, content);
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. }
  64.  
  65.  
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement