Advertisement
madras

Untitled

Jan 14th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. // ZADANIE 1.
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ConsoleApp23
  10. {
  11. class Program
  12. {
  13. static void RysujPomieszczenie(int b, int a)
  14. {
  15. Console.Write("*");
  16. for (int j = 0; j < b; ++j)
  17. Console.Write("-");
  18. Console.Write("*\n");
  19.  
  20. for (int i = 0; i < a; ++i)
  21. {
  22. Console.Write("|");
  23. for (int j = 0; j < b; ++j)
  24. Console.Write(".");
  25. Console.Write("|\n");
  26. }
  27.  
  28. Console.Write("*");
  29. for (int j = 0; j < b; ++j)
  30. Console.Write("-");
  31. Console.Write("*\n");
  32.  
  33.  
  34. Console.WriteLine("Dlugosc: {0} m", a);
  35. Console.WriteLine("Szerokosc: {0} m", b);
  36. Console.WriteLine("Pole: {0} m2", a * b);
  37. }
  38.  
  39. static void Main(string[] args)
  40. {
  41. Console.Write("Podaj ilosc pomieszczen: ");
  42. int n = int.Parse(Console.ReadLine());
  43.  
  44. int[] ta = new int[n];
  45. int[] tb = new int[n];
  46.  
  47. for (int i = 0; i < n; ++i)
  48. {
  49. Console.Write("Podaj dlugosc pomieszczenia {0}: ", i + 1);
  50. ta[i] = int.Parse(Console.ReadLine());
  51. Console.Write("Podaj szerokosc pomieszczenia {0}: ", i + 1);
  52. tb[i] = int.Parse(Console.ReadLine());
  53.  
  54. if (ta[i] < 2 || tb[i] < 3 || ta[i] > 25 || tb[i] > 40)
  55. {
  56. Console.Write("Zla dlugosc i szerokosc!\n");
  57. return;
  58. }
  59. }
  60.  
  61.  
  62. for (int i = 0; i < n; ++i)
  63. {
  64. RysujPomieszczenie(tb[i], ta[i]);
  65. }
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement