 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Albert Guest
|
Posted: Tue Dec 14, 2004 8:07 pm Post subject: short, amusing, projects for learning |
|
|
Given that the subject of teaching C++ to beginners has been topical
of late, I thought it might be appropriate to discuss what are
good, small projects to get people started. I'll take the liberty
of starting with two things that helped me to understand the language--my
personal biases will be evident.
1) Generates lists of primes.
Mostly not C++ specific, but I think a good starting point.
While students won't be able to match the state-of-the-art,
someone will realize that to check N one only needs to attempt
division by up-to sqrt(N). Also, one can show the limitations
of the built-in integer type, can can demonstrate that the same
code can work by simply substituting a "BigInt" class.
2) A class that represents a polynomial in one variable. If students
have some idea of what a polynomial is, then this is a nice example
of encapsulation. Also, it leads naturally to the idea of templates,
as the same code should work whether the coefficients are int's
or doubles. Further, once one has Poly<T>, one can have
Poly< Poly , etc.
Ok, neither is particularly profound. I know Koenig and Moo have
many examples. The text is certaintly excellent. Yet the first
several chapters work around the example of calculating students'
grades. This is a good example in that it does not assume much
background on the part of the students, but somehow it doesn't
excite me .
Sincerely,
Mike Albert
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Andrey Butov Guest
|
Posted: Thu Dec 16, 2004 1:21 pm Post subject: Re: short, amusing, projects for learning |
|
|
www.topcoder.com lists all of its programming problems (and the
solutions of a few hundred members) in their practice rooms, with
problems going back at least a year. The problems cover mostly
algorithmic topics, but there are all formed in an interesting way.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
richardv2 Guest
|
Posted: Thu Dec 16, 2004 1:46 pm Post subject: Re: short, amusing, projects for learning |
|
|
Several that I like:
For random numbers/arrays: Roll two die 1 to 32,000 times and report
occurrance of numbers 2 through 12.
For file handling & basic math: Read a text file (with about 5000 ints)
and report stuff like:
How many numbers
total
average
how many 11's in the file
biggest number
smallest number
For loops and do...while: Computer guesses a number from 1-99. Human
has 7 guesses to find correct number. Only computer output allowed "You
win", "Too high", "Too low" and then "You lose" after 7 incorrect
guesses. Next iteration is add "Play again?" feature to make game
continue until user exits.
For math students: Square root by successive approximations.
For Chess players: 8 (or n) queens problem or Knight's tour. (Not for
beginners though.)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Warwick Guest
|
Posted: Fri Dec 17, 2004 1:37 pm Post subject: Re: short, amusing, projects for learning |
|
|
On 14 Dec 2004 15:07:30 -0500, Michael Albert wrote:
Drawing the mandelbrot set?
It was a task not included in any of the courses i have done, but as a
personal project I got really involved in it. I think I learnt a lot from
it.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|