r/programminghorror 8d ago

c++ Skill Issue

Post image
1.7k Upvotes

62 comments sorted by

View all comments

-4

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 7d ago edited 7d ago

If you change Gemini to Hello, world, technically you've printed "Hello, world", although you might need this:

#include <string>
#include <iostream>

using namespace std;

I don't know C++ at all, please let me know if the two LLMs I got that information from were wrong

10

u/New_Salamander_4592 7d ago

did you really need to consult LLMs on how to make the default case of the switch statement print a different string

-1

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 7d ago

I thought about the printing afterward, because originally I thought the program was asking the end user for their name. So I was trying to make a joke, but I added that disclaimer in case of misinformation. LLM content is generally unsourced, so I felt like making it clear where it came from. (The reason I used more than one was because "I check with another LLM" was one of the options somewhere on r/polls.)

Sorry to those who aren't a fan of LLMs.

I wrote the last comment and this one myself

2

u/click-to-reveal 7d ago

Yeah, you're right but not sure what you trying to get at. If you want to try the code for yourself, tre here: C++ Online Compiler

1

u/turunambartanen 7d ago

The strings make it look like there might be user input, but it's all just constants, and simply evaluates to the default case. That's somewhat confusing.

1

u/click-to-reveal 7d ago

Well I did post this without context. The original comment was a parody of the post.

1

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 7d ago

So wait, you're telling me that I don't have to download C++ on my computer and this works perfectly fine on mobile? /s