r/learnprogramming • u/Citrusfreind • 17h ago
any sites that help you practice c++? (That dont require you to type the hello world code in every time)
Basically the title. ive been trying to find a good site like w3 schools (W3 schools dosent have all the c++ stuff i need for class) that dosent require you to type out the hello world script to access it because its starting to get annoying
6
1
u/OkOcelot6725 16h ago
Two more to add to the others: HackerRank (C++ domain) and Codeforces-style judges give you the main() scaffold and just ask for the function, so no hello-world boilerplate. For quick experiments, Compiler Explorer (godbolt.org) lets you paste a snippet and see output and compiler warnings right away. Locally, keep one template.cpp with includes and main() and copy it for each exercise.
1
u/SpaceAviator1999 13h ago edited 12h ago
I don't know if these sites fit your bill, but they allow me to quickly try out some C++ code snippets in a web browser:
- https://tio.run/ : Lets you try out many languages, C++ included. Click the "Hello World" button (near the top right) to generate a tiny working program for you, then you can type in whatever you want. (TIO is short for "Try It Online.")
- https://glot.io/ : Another site that lets you try out many languages, C++ included.
- https://www.programiz.com/ : Another site that lets you try out many languages, including C++.
- https://cpp.sh/ : A site that lets you test out C++ code from multiple standards (like C++98, C++11, etc.).
1
u/MoinHashmi 15h ago
The annoying part you describe is exactly why a lot of people switch tools early. The real fix is not finding a better W3Schools. It is picking a setup that remembers your boilerplate for you.
Two options that fix this directly:
Use sites with a pre-filled template. HackerRank and LeetCode both pre-fill the function skeleton in their C++ problems, so you only write your logic and never touch main. On sites like CSES or Codeforces you paste your whole solution, but you can keep one personal template file (with bits/stdc++.h and fast IO turned off sync) and paste it once per problem. I keep a single template file open and copy it over. It takes five seconds and the annoyance is gone.
Go local a bit sooner than feels comfortable. Install g++ once, open your code in VS Code, and keep one starter file ready. Compile with a simple g++ command and run it. It takes about a day to get used to, and you get something no website gives you: real debugging, where you can pause and watch your variables change. That is the part of C++ practice that actually made it click for me.
One more thing: learncpp.com is genuinely the best free C++ tutorial on the internet, much deeper than W3Schools. Just check which C++ version your class uses first. learncpp teaches modern C++ (C++17 and newer), and some university material still uses an older style, so it helps to know the difference so your class code and your practice code match.
I am still fairly early in my own journey, but the week practice stopped feeling annoying was the week I stopped fighting the website editor and moved to my own editor plus one template file. Try that for a week and see if it sticks.
0
u/Blissextus 16h ago
Visit learncpp.com and purchase a highly regarded book on Modern C++. These two should be enough to get you going on your C++ journey.
It's best not to "practice" C++ using the online text/compiler websites. You'll get more value learning C++ using and IDE (or text editor) and compiler installed on your machine.
0
u/Defiant-Ad7368 16h ago
One guy gave you a proper learning website. if you are looking for further practice I suggest doing a couple of projects like a deck of cards library and then develop some card games (even if only doing the logic with zero UI) or designing a chess game and implementing it (with the chess game you can go one step ahead and think about how to implementing it in the web and introduce yourself to client-server architecture)
3
u/thondat 16h ago
the C++ track on exercism.com.