fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. bool& Roleplay(int type)
  5. {
  6. if (type == 10) {
  7. static bool x;
  8. return x;
  9. }
  10. if (type == 20) {
  11. static bool y;
  12. return y;
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. int Erotic = 10;
  19. int ForScrubs = 20;
  20. Roleplay(Erotic) = false;
  21. Roleplay(ForScrubs) = false;
  22. printf("Awkward funtimes? %d\n", Roleplay(Erotic));
  23. printf("Greytide ahoy? %d\n", Roleplay(ForScrubs));
  24. Roleplay(Erotic) = true;
  25. printf("Awkward funtimes? %d\n", Roleplay(Erotic));
  26. printf("Greytide ahoy? %d\n", Roleplay(ForScrubs));
  27. return 0;
  28. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Awkward funtimes? 0
Greytide ahoy? 0
Awkward funtimes? 1
Greytide ahoy? 0