Untitled
unknown
plain_text
2 years ago
1.5 kB
6
Indexable
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Cwiczenie1 { class Zbior { public int [] Zbiory (int [] z1, int [] z2) { z1 = new int[] { 1, 1, 2, 3, 4, 5 }; z2 = new int[] { 4, 1, 33 }; Console.WriteLine(z1); return z2; } /*public static Zbior Metoda4(Zbior z1, Zbior z2) { for (int i = 0; i < ; i++) { } } */ } class Program { static void Main(string[] args) { /* Zdefiniuj klasę Zbiór - zbiór liczb całkowitych – z polem liczby będącym tablicą int (uwzględnij zbiór pusty ma to być tablica pusta { } a nie null). Napisz metodę Zbior Metoda4(Zbior z1, Zbior z2), która ze zbioru liczb z1 usuwa liczby znajdujące się w drugim zbiorze z2 np. {1, 1, 2, 3, 4, 5 } oraz {4, 1, 33 } daje wynik {2 ,3 ,5}.*/ int[] z1 = new int[] { 1, 1, 2, 3, 4, 5 }; int[] z2 = new int[] { 4, 1, 33 }; //wyswietlamy tablice z liczbami przed usuwaniem elementow for (int i = 0; i < z1.Length; i++) { Console.WriteLine(z1[i]); } for (int i = 0; i < z2.Length; i++) { Console.WriteLine(z2[i]); } } } }
Editor is loading...