C++ Tutorial
C++ Projects
Ten complete C++17 programs: a calculator, a student list, a library catalog, and a shopping cart.
What a project is on StudyGrid
A C++ lesson shows one idea: a vector, a class, a map. A project puts several of them in one compiling program. Each page here walks from a small slice to a complete C++17 program you can run.
Click Try it in C++ under an example. That opens /cpp/try — g++ in the browser. Programs use hardcoded demo data so they run without extra stdin. After you understand the logic, wire in cin if you want typed input.
10 build-along projects. Each page walks through the design, then a working program you can open inTry C++ at /cpp/try. Change a value, run it again, then try the practice tasks at the bottom.
The 10 projects
Calculator
A four-function calculator with functions per operator and a check for divide-by-zero.
functions · if · doubleBeginnerStudent Manager
Store students in a vector of structs, print the roster, and find the top score.
vector · struct · loopIntermediateBank System
An Account class with deposit, withdraw, and a printed statement. Balance never goes negative.
class · methods · doubleBeginnerQuiz Game
A scored quiz from a vector of questions. Print each prompt, check the answer, and tally.
vector · struct · scoreIntermediateLibrary Catalog
A catalog of books with title, author, and year. Search by author and list every match.
vector · string · findBeginnerTemperature Converter
Convert Celsius, Fahrenheit, and Kelvin with a small set of functions and formatted output.
functions · iomanip · doubleIntermediateTic-Tac-Toe
A 3x3 board as a vector of strings. Place marks, print the grid, and detect a winner.
vector · loops · functionsIntermediateContact Book
Store contacts in a map from name to number, then add, find, and list them in order.
map · string · iterateBeginnerGrade Calculator
Convert numeric scores to letter grades, compute a GPA-style average, and print a report.
vector · functions · averageIntermediateShopping Cart
A cart of line items with name, quantity, and price. Print a receipt and the grand total.
struct · vector · moneyHow to work a project
- Read the goal and the C++ skills listed on the page.
- Compile the first small example at
/cpp/try. - Build up to the complete program.
- Change one value and compile again.
- Finish the practice tasks before the next project.