fork(1) download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <string>
  4. using namespace std;
  5. #define checkthisy
  6. struct a
  7. {
  8. string b;
  9. int c;
  10. };
  11. void f(a &q) //lol
  12. {
  13. if(q.c < q.b.length())
  14. {
  15. #ifdef checkthis
  16. q.b[q.b.length()-q.c]='\0';
  17. #else
  18. q.b.erase(q.b.begin()+(q.b.length()-q.c),q.b.end());
  19. #endif
  20. cout << q.b << '\n';
  21. }
  22. }
  23. int main()
  24. {
  25. a q = {"mam",4};
  26. a w = {"ale nie mam",4};
  27. a e = {"janusz biznesu",8};
  28. a r = {"zlote kalesony",4};
  29. a t = {"qwertyui",5};
  30. a y = {"xcvbnm,", 6};
  31. f(q);
  32. f(w);
  33. f(e);
  34. f(r);
  35. f(t);
  36. f(y);
  37. }
  38.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
ale nie
janusz
zlote kale
qwe
x