Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <conio.h>
- #include <algorithm>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- void kodPoczt(string dane, string szukana)
- {
- size_t pozycja = -1;
- string maybe;
- while((pozycja = dane.find(szukana, pozycja+1)) != string::npos)
- {
- maybe = dane.substr(pozycja-2, 6);
- if(maybe.find_first_of("01234456789") == 0)
- cout << "Kod pocztowy: " << maybe;
- }
- }
- bool algerba(string dzialanie)
- {
- string szukaj = "+-*/";
- string zakaz1 = "()";
- string zakaz2 = "*/";
- size_t pozycja = -1;
- int blad = 0;
- while((pozycja = dzialanie.find_first_of(szukaj, pozycja+1)) != string::npos)
- {
- for(int i = 0; i < 4; i++)
- {
- if(dzialanie[pozycja] == szukaj[i])
- {
- if(dzialanie[pozycja+1] == zakaz2[i]) blad+=1;
- }
- if(dzialanie[pozycja] == zakaz2[i])
- {
- if((dzialanie[pozycja-1] == zakaz1[i]) && (dzialanie[pozycja+1] == zakaz1[i])) blad+=1;
- else if(dzialanie[pozycja-1] == zakaz1[0]) blad+=1;
- }
- }
- }
- if(blad >= 1) return false;
- else return true;
- }
- int main()
- {
- //CWICZENIE
- /*
- string tekst = "Brzoskwiniowa 50 87-100, Torun Dawid -Parowski";
- kodPoczt(tekst, "-");
- */
- //CWICZENIE
- /*
- cout << "Dzialnie: ";
- string dzialan;
- cin >> dzialan;
- cout << algerba(dzialan);
- */
- //CWICZENIE
- /*
- ofstream plik1;
- plik1.open("plik1.txt");
- string tab;
- while(true)
- {
- getline(cin, tab);
- if(tab == "") break;
- plik1 << tab << endl;
- }
- plik1.close();
- */
- srand(time(NULL));
- int liczba;
- int j = 0;
- int m;
- string znaki= "";
- string litera = "P";
- for(int i = 0; i < 10; i++)
- {
- cout << endl;
- for (int j = 0; j < 10; j++)
- {
- liczba = rand()%101+0;
- if(liczba+17 == 77)
- {
- znaki += "@";
- cout << "@ ";
- }
- else
- {
- if(liczba%2 == 1)
- {
- znaki += "*";
- cout << "* ";
- }
- else if(liczba%2 == 0)
- {
- znaki += "#";
- cout << "# ";
- }
- }
- }
- }
- liczba = rand()%101+0;
- cout << endl << endl << endl;
- for(int i = 0; i < 10; i++)
- {
- cout << endl;
- for(int k = 0; k < 10; k++)
- {
- if(j == liczba)
- {
- znaki[j] = 'P';
- m = j;
- }
- cout << znaki[j] << " ";
- j+=1;
- }
- }
- /*
- string kierunek;
- string buf;
- string dot = ".";
- while(kierunek != "0")
- {
- j = 0;
- for(int i = 0; i < 10; i++)
- {
- cin >> kierunek;
- cout << endl;
- for(int k = 0; k < 10; k++)
- {
- if(kierunek == "w")
- {
- znaki[m] = '.';
- znaki[m-10] = 'P';
- }
- cout << znaki[j] << " ";
- j+=1;
- }
- }
- }
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement