GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — cpp_coding_stuff/funkcje bool.cpp at master · KasiaCat/cpp_coding_stuff Expand file tree/ Copy pathfunkcje bool.cppMore file actions 53 lines (43 loc) · 1.37 KB / Copy pathfunkcje bool.cppFile metadata and controls53 lines (43 loc) · 1.37 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 #include <iostream> #include <cstdlib> // #include <cctype> //biblioteki dla funkcji lowercase i uppercase // #include <ctype.h> using namespace std; bool jestDuzaLitera (char z) //funkcja: isupper { //jesli z jest duza litera return (z >= 'A' && z <= 'Z'); } bool jestMalaLitera (char z) //funkcja islower { //jesli z jest duza litera return (z >= 'a' && z <= 'z'); //tak zapisujemy zamiast if-ow } bool jestLitera (char z) //funkcja isalpha { return ( jestDuzaLitera(z) || jestMalaLitera(z) ); } bool tylkoLiteryWNapisie( char napis[] ) //funckja kosz, wylapie smieci { for (int i = 0; napis[i] != '\0'; ++i) if ( !( jestDuzaLitera(napis [i] ) || jestMalaLitera(napis [i] ) ) ) return false; return true; } int main() { const int N = 80; char imie [N]; cin.getline(imie, N - 1); //czyta cala linie (nie do spacji) //N - jako streamsize (musi byc rozmiar), mowimy ile co najwyzej ma wczytac // wpisujac streamsieze - N, nie przepelniam bufora if (tylkoLiteryWNapisie( imie )) cout << endl << "Poprawne imie"; else cout << endl << "Nie poprawne imie"; //graficzna wizualizacja ASCII, sprawdzamy czy cos jest duza litera //uzywam ASCII -> w ascii A duze, ma wartosc 65 cin.ignore(); cin.get(); return EXIT_SUCCESS; } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |