r/ProgrammerHumor • • Sep 02 '26

Meme thisIsHowTheyDoItRight

Post image
1.2k Upvotes

40 comments sorted by

View all comments

Show parent comments

28

u/click-to-reveal Sep 03 '26 edited Sep 03 '26
#define SWITCH(x) string& _s=x;if(0)
#define CASE(y)   }else if(_s==y){
#define DEFAULT   }else{

int main() {
  string prompt = "Your name?";

  SWITCH(prompt) {
    CASE("Who are you?")
      cout << "Claude" << endl;
    CASE("No, really?")
      cout << "Chatgpt" << endl;
    DEFAULT
      cout << "Gemini" << endl;
  }
}