Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NWW I NWD
- <cmath> - abs(); - zwraca wartość bezwzględną
- pow(liczba,potęga) - potęguje liczbę
- <fstream> - otwarcie pliku
- str.length(); - długość stringa
- swap(str1,str2); = zamiana między sobą (np. w sortowaniu bąbelkowym)
- <string> - str.size(); - wielkość , if(str1.size() == str2.size()) { if (str1>str2) { //do smth } } = porównanie dwóch stringów jeżeli wielkość jest taka sama
- <csdtlib> + <time.h>
- srand(time(NULL)); + rand(); = losowa liczba
- Sortowanie bąbelkowe:
- for(int i=0;i<ilosc;i++){
- for(int j=0;j<ilosc;j++){
- if(tab[j]>tab[j+1]){
- swap (tab[j],tab[j+1]);
- }
- }
- }
- string dectobin(int l)
- {
- if ( l == 0 )
- {
- return "0";
- }
- if ( l == 1 )
- {
- return "1";
- }
- return l % 2 == 0 ? dectobin(l / 2) + "0" : return dectobin(l / 2) + "1";
- } - zamiana dec to bin
- int fib(int n)
- {
- if(n == 0) return 0;
- if(n == 1) return 1;
- return fib(n-1)+fib(n-2);
- } - ciąg Fibonachiego
- Ile liczb jest pierwszych?
- 1 nie jest liczbą pierwszą
- 2 jest liczbą pierwszą
- https://pastebin.com/NCdBjb6F 2k15
- https://pastebin.com/i8kZQ1Q8 - 2k16 cezar
- https://pastebin.com/DZVTa0Jd - 2k10
- https://pastebin.com/dG7EL53j - 2k15 stara podstawa
- https://pastebin.com/uh9Yg7jh - 2k14 próbna
- - https://pastebin.com/raw/GF5B2jTY - hasla
- - https://pastebin.com/raw/zi4KRs28 - anagramy
- https://pastebin.com/U4QdW5xv - palindromy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement