Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. auto isOdd = []()->bool
  9. {
  10. int a;
  11. cin >> a;
  12. if (a % 2 != 0) cout << "true" <<endl;
  13. else cout << "false" <<endl;
  14. return (a % 2 != 0);
  15. }();
  16.  
  17. string string1 = "abc";
  18. string string2 = " def";
  19. auto concatenateString = [](string a, string b)->string
  20. {
  21. string s1 = a + b;
  22. cout << s1 << endl;
  23. return s1;
  24. }(string1, string2);
  25.  
  26. vector<string> wektor;
  27. wektor.push_back("abc");
  28. wektor.push_back("ABC");
  29. wektor.push_back("XyZ");
  30.  
  31. for_each(wektor.begin(), wektor.end(),
  32. [](string string1)->int {
  33. int size = string1.size();
  34. cout << string1 << " " << size << endl;
  35. return size;
  36. });
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement