fork download
  1. #include <iostream>
  2.  
  3. static int x = 0;
  4.  
  5. char* f()
  6. {
  7. static char* words[] = {"One", "Two", "Three"};
  8. return words[(x++) % 3];
  9. }
  10.  
  11. int main() {
  12. std::cout << f() << std::endl << f() << std::endl << f();
  13. return 0;
  14. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
Three
Two
One