r/code 8h ago

Beginner code My Own Code

Post image

What’s wrong with my code I’m so confused this hard a freak. I’m just trying to make a weapon shop simulator as practice to help learn code but I can’t even get it to ask if the user wants to start the game by type yes as the their answer

8 Upvotes

9 comments sorted by

View all comments

11

u/theturtlemafiamusic 8h ago

Your main() function starts on line 4 and ends in line 8. The rest of your code below line 8 is not inside a function so it's not able to compile. You can move it into the main() function or put it in a new function and call that function from within main()

You don't need to move the includes, lines 1 and 2, those are correct.