### Requesting exercises for beginners

Hello everyone, I'm new to the forums and I have recently just got into studying C++ a month ago and I've been looking for some mini exercises to help practice what I've studied so far. The tutorials are very helpful but it does not seem to provide any tasks to perform after each chapter to practice the stuff you've just learned.

I've learnt all the basics:
Structure of a program
Variables and types
Constants
Operators
Basic Input/Output

Thanks
There was an article that used to be quite popular here that was full of fun little exercises and one larger "bunny problem" at the end. Maybe some of these will prove interesting:

http://www.cplusplus.com/forum/articles/12974/

-Albatross
Try this (question made on my own):
A triangular number is generated by the following formula (n^2+n)/2. Make a program which takes in a limit from the user and sums up all the triangular numbers till that limit. Then display the result to the user.

You can read more on triangular numbers here: http://en.wikipedia.org/wiki/Triangular_number

Extra credit:
2) Show the user a prompt like "Enter a limit: " and "Result: ".
3) Try to use meaningful variable names

Post your code when you are done and I'll check it tomorrow ;) (Its 10:38 PM here).

-Cheers
Last edited on
A simple game is the best exercise because it's all programming logic and doesn't require you to solve a Math problem before you can start coding.

The key is to learn how to structure your code for optimal readability and reusability and Games are perfect for that.

So start with something simple like a Mad Libs games and then try to move on to something a bit more involved such a board based game where you can familiarize yourself with 2D arrays such as Battleship, Checkers, or even Chess.
I found that math puzzles from [url]projecteuler.net[/url] helped me learn to think like a programmer and helped especially with algorithmic thinking. You will want to know about iteration (for, while, do while) and selection (if, switch) for that.

Also, I second what IceThatJaw said.
Last edited on
Topic archived. No new replies allowed.