SQL Practice
sqlpractice.co.in
Languages Learn Practice Playground Interview
Run code
Languages Learn Practice Playground Interview SQL Search
Home / C++ / Practice

C++ exercises

Exercises with full test sets for C++ are being written and verified. Until they are published, every lesson ends with a short program to write, with its expected output.

  • C++ Syntax and Your First ProgramHow a C++ program is put together: #include, main(), statements, blocks and std::cout, plus how to compile and run it with g++ -std=c++17.8 minCompleted
  • Variables and Types in C++Declaring C++ variables with int, double, char, bool and std::string, initialising them, using const and auto, and why an uninitialised variable is a bug.9 minCompleted
  • Operators in C++C++ arithmetic, comparison, logical and assignment operators: integer division and modulo, prefix versus postfix ++, short-circuit evaluation and precedence.9 minCompleted
  • Conditions in C++: if, else and switchHow C++ chooses between paths with if, else if and else, switch with break, the ?: operator and the C++17 if with an initialiser, with runnable examples.8 minCompleted
  • Loops in C++: for, while and do-whileC++ loops explained: the three parts of a for loop, while and do-while, reading input until it ends, nested loops, and when to reach for break or continue.9 minCompleted
  • Functions in C++Defining and calling C++ functions: return types, parameters, prototypes, pass by value versus by reference, default arguments and overloading, with examples.10 minCompleted
Exercises in other languagesC++ lessons
SQL Practice

Free tutorials, exercises and browser-based playgrounds for SQL, Python, JavaScript and more. Every example was run before it was published; your code runs on your own device.

Learn

  • All languages
  • Learning paths
  • Free SQL course
  • SQL beginner's guide
  • SQL glossary
  • Interview preparation

Practice

  • All exercises
  • SQL exercises
  • Guided projects
  • Code playground
  • SQL playground
  • Search

Site

  • About
  • How we verify
  • Contact
  • Privacy Policy
  • Terms of Use
  • Open Source Licenses
  • Disclaimer
© 2026 SQL Practice. Your code runs locally in your browser. RSS feed