Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace P22_constructori
  9. {
  10. class Tablou
  11. {
  12. private int n;
  13. private int[] a;
  14.  
  15. public Tablou(int dim)
  16. {
  17. n = dim;
  18. a = new int[n];
  19. Random r = new Random();
  20. for (int i = 0; i < n; i++)
  21. a[i] = r.Next(100);
  22. }
  23.  
  24. public Tablou(int dim, int val)
  25. {
  26. n = dim;
  27. a = new int[n];
  28. for (int i = 0; i < n; i++)
  29. a[i] = val;
  30. }
  31.  
  32. public Tablou(string fis)
  33. {
  34. if (!File.Exists(fis))
  35. {
  36. Console.WriteLine("Fisier inexistent");
  37. n = 1;
  38. a = new int[1];
  39. a[0] = 0;
  40. return;
  41. }
  42.  
  43. StreamReader fin = new StreamReader(fis);
  44. n = int.Parse()
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement