Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- // transformacje na napisach, na ocenÄ™
- void trs() {
- string str1, str2, _str1;
- cout << "podaj 4 wyrazy: ";
- getline(cin, str1);
- _str1 = str1;
- transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
- cout << "lowercase: " << str1 << "\n";
- transform(str1.begin(), str1.end(), str1.begin(), ::toupper);
- cout << "uppercase: " << str1 << "\n\n";
- cout << "podaj 4 wyrazy: ";
- getline(cin, str2);
- cout << "konkatenacja: " << _str1 + " " + str2 << endl;
- }
- // oblicz n!, iteracyjnie
- unsigned long long itr_fact(int n) {
- unsigned long long sum = n;
- for(int i = n - 1; i > 1; i--) sum *= i;
- return sum;
- }
- // oblicz n!, rekursywnie
- unsigned long long rec_fact(unsigned long long n) {
- if (n == 2) return n;
- return n * rec_fact(n - 1);
- }
- int main() {
- cout << "itr: " << itr_fact(5) << "\n";
- cout << "rec: " << rec_fact(5) << "\n\n";
- trs();
- return 0;
- }
Add Comment
Please, Sign In to add comment