Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It might be a bit young to be learning C++, but I've been hired to tutor a ten year old and I will happily oblige! I'm struggling to think of some fun but easy programs to work on. Ideally, I'm looking for something that can be done with a basic understanding of if statements, while loops, variables, vectors, input, and output. I came up with the idea of writing a "Mad Libs" style program, where it asks the user for input (adjectives, nouns, etc) and then outputs a story with that input filled in. However, he didn't seem very interested in this idea since he does not like "Mad Libs".

I feel like he might be particularly interested in writing a program that has a visible effect on his computer. For example, he loves figuring out key presses to do things like invert his computers color, etc.

Any ideas for a fun/easy C++ program for a 10 year old?

share|improve this question
8  
Any reason it has to be C++? Kids are really into the web and phones. His own iPhone app in Objective C or a little jQuery as part of his own website sound like fun projects. –  mrtsherman May 15 '11 at 3:13
2  
So yeah, talked him into some web programming and this seems like the way to go. He's doing much better now, since: a) He gets to make things he actually thinks are cool (he's making a tribute site to mammatus clouds) b) It's easier –  Casey Patton Jun 9 '11 at 9:12
show 4 more comments

migrated from stackoverflow.com May 15 '11 at 3:27

This question came from our site for professional and enthusiast programmers.

closed as off topic by Anna Lear Feb 8 '12 at 23:23

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

16 Answers

There's always the old standby "Guess My Number" program... sample output below.

$ ./guess_my_number
Hello user!  I'm thinking of a number between 1 and 100.  See if you can guess it!
50
Higher!
80
Lower!
65
Higher!
66
You guessed it in 4 guesses, congratulations!
share|improve this answer
5  
Btw you can also do it the other way, where the user thinks of a number and the program tries to guess it. –  Jeremy Friesner May 15 '11 at 4:23
show 2 more comments

You might want to consider trying out an Arduino microcontroller. You can do some really neat projects in very simple C or C++ and have the programs make things like blink some LEDs, make sounds with a piezo, turn servos. The coolness factor is that he will be writing code that interfaces with the physical world and give him something very tangible, while reinforcing some of the basics of programming. You can even have him interface with the serial port and send commands from the computer to the Arduino to dynamically control the LEDs or whatever. Check it out.

share|improve this answer
show 2 more comments

Pictures!

Pikachu Edge Detection

Tell him what a bitmap is (three numbers, one for each of red/green/blue), make a simple Bitmap class or something for him that will load a file and allow its pixels to be accessed through coordinates, and then tell him to try to think of ways to do things like:

  • Invert the colors (easy)

  • Swap the RGB colors (easy)

  • Change the brightness (medium-hard)

  • Change the hue (medium-hard -- but teach him what that means first)

  • Find the edges in the picture (very hard, but I think it'll be fun!)

(The algorithm for the last one, without resorting to college-level math, would be to slightly shift the picture and "subtract" it from the original one, so that only the edges remain.)

share|improve this answer
2  
@Mehrdad: nice pikture! I agree that visual materials are probably a good way to get a kid interested. They don't have much abstract representation yet. –  Matthieu M. May 15 '11 at 7:57
2  
Seriously? I mean, idea, in principle, is OK, but it requires understanding RGB/HSV model, loading a bitmap, dynamic memory management with non-trivial data structures... Most kids in college are not capable of doing this. –  Davor Ždralo May 15 '11 at 10:37
3  
-1 Even though this may sound fun, it's pretty damn hard to EXPLAIN to a 10 year old how he did what he did, he mmight have written it "by himself" but he can't learn anything from it. –  Ziv May 15 '11 at 11:24
1  
@Davor, I was writing a database in BASIC when I was 10. Ok, I didn't know relational logic, but it allowed me to store and retrieve data. –  Peter Taylor May 20 '11 at 22:20
show 5 more comments

This is a bit of my personal experience sharing, one of the key things will be teaching them something that's related to the real life or something like you mentioned which can trigger some visual or sound cue, and at the same time imparting them the right concept of structural and object oriented programing.

I myself started learning programming at very young age (9 years old) from dbase4, clipper, basica, foxpro, fortran, turbo pascal, blah.... some of the interesting ideas like:

  1. Teach them how to write a program to input different color, say, "yellow, red, blue" and the screen background change to that color, or output the next string in the mentioned color.

  2. Teach them how to write a program that calculate the difference between two time ( 10:01 am and 2:25pm)

  3. Teach them how to use loop to draw some simple ascii art, like

    *
    **
    ***
    ****
    *****
    ****
    ***
    **
    *
    
  4. Teach them how to create a simple calculator, or implement some algorithm.

  5. How to use the PC speaker to play some simple tunes, and create a song.

Hope that it's useful and I will include more ideas along the way when I have thought of anything.

Regards,
Andy.

share|improve this answer
show 2 more comments

I got into programming at age 11, but not because I wanted to program, but because I wanted to make games. So for me programming was a means to a goal, not necessarily the goal itself.

I'd say pick a project that not only can be related to real world, but pick a project that the kid can personally relate with. One of my first ones was to create a Lode Runner which I wrote in Basic. I got it basically working, but got too tangled trying to make floor tiles disappear (my map was too static).

Maybe pick something that the kid actually wants to make, then break it down into smaller individual lessons which would boil things down to basics but every lesson would fit into a greater scheme that would keep his interest.

While you are at it, you should also introduce daily scrum meetings and teach him planning poker ;)

share|improve this answer
add comment

My then-13 year old enjoyed writing "enter your name in this box and click the button, then I will say Hello yourname", and "guess the number I am thinking of, I will say higher and lower till you get it right", along with several things I would not have called games: choose two colours from dropdowns and get a checkerboard made of those colours; click to draw a small circle where you clicked, so you can draw by clicking (later enhanced to add a dropdown to let you choose the colour); enter 5 numbers and get a histogram of them, and so on. Once those were written and shared with friends, he started in on hangman by himself.

Are you choosing C++ because you know it? Few people know C++ as well as I do, but I taught my guy VB (because I happened to have a CD for adults that taught it and had exercises), then VB.NET (because it was a short trip from VB), then C# (because it's the same toolset and library.) Why? because they came with a GUI library. If you go with Java, C#, or some other brace-brackety-thing that comes with a GUI library, things may go a little quicker and more fun. In the case of C#, there is also a games framework. Once he had completed hangman pretty much by hand, we took up the XNA framework, so he could do 2D and 3D games with graphics of his own design. The speed of getting something recognizable was important to his enjoyment of it.

(C# Express and XNA are free, so you don't have to spend money to help.) I'm not arguing you onto the Microsoft stack, but I am arguing for a GUI library and a powerful IDE.

share|improve this answer
add comment

Give him some interaction with C++ and the program he is writing - I'd start by building a simple program that captures key input and then converts the background to a color, instantly. Every key is a different color. Build on that by adding sounds or something similar. If that grabs his attention, I'd work with his interests to see what you can build next.

share|improve this answer
show 3 more comments

If you are not fixed on C++ there is a project called "Ruby For Kids" Which looks good and sounds like it could be fun.

share|improve this answer
add comment

After he gets the basics down a text adventure more in the vein of a choose-your-own-adventure game is pretty fun. Those were some of the first things I did when I started programming at a young age. You can use this to teach him program flow - help him design a short story on paper and get him to plot out a few decision points, and then let him write the responses to those decisions.

After constructing the story with a few branching paths help him translate it into code. This sort of thing will really let him flex his creative muscles while showing him the importance of design, and eventually how programming can lead to an interesting end result.

share|improve this answer
add comment

I'd strongly look at engaging them with a Lego NXT system (or, if they want to really get into some cool HW projects, an Arduino or Beagle Board kit)

You can do some very neat and very visible/tactile with hardware that is also reasonably easy to understand. (If you go Arduino/Beagle Board, you might need to create a starting framework for them that looks like a "black box" to them...)

Also, just because I learned Fortran and Basic this way:

  • Maybe identify some games they might want to work on? Casino style games like Blackjack usually have an easy "AI" to program and betting options and more players adds increasing levels of complexity
  • If sports is the thing, maybe create a stat analyzer to build "dream teams" or manage a fantasy league?

In general, find something they are interested in and work to build something related to that.

A bit meta, but... also come up with a set of concepts/skill that you want your student to come away with. Look at their skill set and understanding. How much OO do you want them to learn? Is it more important to learn/teach the syntax or more important to understand programming concepts? Come up with a teaching plan first, what to cover and re-enforce each week. You may find that in the course of diving into different aspects, you student has more aptitude/interest in "math" or "playing with data" or "file manipulation" or "abstracting things" Pick projects that can morph with their interest in the details of programming.

have fun!

share|improve this answer
add comment

One of the first games I did, was Blackjack with ASCII graphics. When more advanced, you can do the waterfall (require, (raw) design, code, test) for something like Tetris.

share|improve this answer
add comment

When my kid was ten I found this tank arena based game that had a well documented API.
I forget the name (but I am sure it is still around).

You need to know the basics of C++ to start with, but once you have that it allows you to teach them programming against an API (and its fun). Show your kid how to create a tank application that wins against the default robots.

Then you can challenge them by writing your own tank controller and see which application can win. When the child looses they are really interested in finding out what you did to make your tank better/faster and thus helps keeps them focused when you explain things. When their tank wins its a good excuse to take them for ice-cream (re-enforce) the good programming. Then you can help them find improvements in their code that makes it more efficient/smarter.

share|improve this answer
add comment

Have you looked at Project Euler?

While most of these are very advanced, the first few I think are definitely doable by a 10 year old with some coaching.

share|improve this answer
4  
Project Euler is as much about math as programming. Once you get past the easy initial questions that can be brute-forced, generally you have to prove (or know) some non-trivial mathematical result in order to optimize the code. If you're tutoring in both math and computing, this could work incredibly well, but a 10-year-old probably (i.e. if they're not Gauss) isn't going to pluck results in number theory out of their general knowledge, or quickly sketch a proof of some vital lemma. So it'll be a lot more new math, and less getting-on-with-the-programming. –  Steve Jessop May 15 '11 at 10:33
show 1 more comment

I remember my first programming problem for C64 BASIC when I was about 10 yrs old. It was pretty simple: program was supposed to write "What's your name?" on the screen, get the user input (say, "John"), and then display "John is a nice guy", or something.

After I went through the basic syntax, I remember the most rewarding thing was displaying different phrases for different family members, and then telling them to try it. It would give something completely different, depending on the name, giving an impression of some simple AI.

Kids that age are pretty happy when they can make pranks such as this. :)

share|improve this answer
add comment

Why not ask them to do something which may be of use in their school as well? "The computer can help you do your homework" sounds like a very attractive proposition (to me atleast). Tasks (Since you say 10-year old, I assume some a basic understanding of math) such as such as:

  • Generating Multiplication tables
  • Basic statistics: Averages, Medians etc.
  • Areas of simple figures: Triangles, Squares etc.
  • Rounding numbers, Checking for Primality, Finding out factors etc.
  • Since you've try some word play, how about a simple pig-latin generator?
share|improve this answer
add comment

I think the group has covered them all but I'd agree with blackjack. It teaches you a wide variety of things and can teach lessons as you go along.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.