Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string generuj() {
- StringBuilder napis = new StringBuilder();
- Random r = new Random();
- string pattern = @"[a-z]{5}[0-9]{5}|[0-9]{5}[a-z]{5}";
- Regex reg = new Regex(pattern);
- string alfabet = "abcdefghijklmnouprstuwxyz";
- for (int i = 0; i < 10; i++) {
- if (i < 5 ) {
- napis.Append(alfabet[r.Next(1, alfabet.Length)]);
- }
- else {
- napis.Append(r.Next(1,9));
- }
- return napis.ToString();
- if (reg.IsMatch(napis.ToString())) {
- Console.WriteLine("Pasuje");
- }
- else {
- Console.WriteLine("Niepasuje");
- }
- }
- return napis.ToString();
- }
- public void zadanie_4() {
- StringBuilder napis = new StringBuilder();
- Random r = new Random();
- Queue<string> kolejka = new Queue<string>();
- Stack<string> stos = new Stack<string>();
- Queue<string> drugakolejka = new Queue<string>();
- string[] napisy = new string[10];
- string alfabet = "abcdefghijklmnouprstuwxyz";
- Regex rw = new Regex("[a,e,i,o,u]+");
- for (int i = 0; i < 10; i++) {
- for(int j = 0; j < 10; j++) {
- }
- if (rw.IsMatch(napis.ToString())) {
- stos.Push(napis.ToString());
- }
- else {
- kolejka.Enqueue(napis.ToString());
- }
- }
- }
- }
- class kolejka
- {
- int[] tablica;
- int ogon = 0, głowa = 0, wielkosc = 0;
- public void dodaj(int liczba)
- {
- if (wielkosc< tablica.Length)
- {
- wielkosc++;
- tablica[ogon++] = liczba;
- ogon = ogon % tablica.Length;
- }
- }
- public void usun()
- {
- int licz =0;
- if (wielkosc != 0)
- {
- licz = tablica[głowa];
- tablica[głowa]=0;
- wielkosc--;
- głowa = głowa + 1 % tablica.Length;
- }
- }
- public void dodajnowe(int n) {
- int ogon2 = 0;
- int i = 0;
- int?[] wartosci = new int?[2 * n];
- if (wielkosc < tablica.Length) {
- wielkosc++;
- wartosci[ogon++] = tablica[i];
- ogon2 = ogon2 % wartosci.Length;
- }
- }
- public kolejka(int wielkosc) {
- dodajnowe(2 *wielkosc);
- }
- }
- class stos {
- int[] numbers;
- private int liczba;
- private int licznik = 0;
- public stos(int liczba) {
- this.liczba = liczba;
- }
- public void dodaj(int liczba) {
- if (liczba != numbers.Length) {
- numbers[licznik++] = liczba;
- }
- }
- public int? usun() {
- int? wartosc = null;
- if (licznik != 0) {
- wartosc = numbers[--licznik];
- }
- return wartosc;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement