Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- // Oliwia Ilnicka 261681
- using namespace std;
- string wspak(string tekst)
- {
- string wynik = "";
- for(int i = tekst.size() - 1; i >= 0; --i)
- wynik += tekst[i];
- return wynik;
- }
- int suma_ascii(string tekst)
- {
- unsigned dlugosc = tekst.size();
- int suma = 0;
- for(unsigned i = 0; i < dlugosc; ++i)
- suma += static_cast<int>(tekst[i]);
- return suma;
- }
- string duze_litery(string tekst)
- {
- unsigned dlugosc = tekst.size();
- string wynik = "";
- for(unsigned i = 0; i < dlugosc; ++i)
- {
- if(tekst[i] >= 'a' && tekst[i] <= 'z')
- wynik += toupper(tekst[i]);
- else
- wynik += tolower(tekst[i]);
- }
- return wynik;
- }
- int main()
- {
- string dane = "Oliwia Ilnicka";
- cout << dane << endl << wspak(dane) << endl;
- cout << suma_ascii(dane) << endl;
- cout << duze_litery(dane) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment