# any beginner ideas?

• 11-24-2005
gunder
any beginner ideas?
I wasn't sure if I should post this here or on the contest board. I'm jumping back into C after a VERY long absence. Basically what I'm looking for are some ideas for programs. I've looked at the contests and the challenges, those are good but I'm looking for something a little more. Something like, "using recursion write a program to do this" or "write two functions, one that does this, one that does that. Use pointers to do this".

I have a couple really good books but they're really boring to go through and they don't have any program ideas. Does anyone have a list of the programming homework they were assigned to do maybe? I would like them to start easy and gradually get harder. I can only write so many hang man games, tic tac toe and phone book programs. Basically I'm just looking for program ideas with some hints on what to use to do it.

Having source available with the solution would be nice but isn't really needed, I would like to figure it out on my own. Thanks in advance for any help and I apologize if this is the wrong board for this.
• 11-24-2005
kermit
I like this idea from K&R2:

Quote:

Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.
At the point of the book that the [above] programming exercise is given, basically the reader has been introduced to getchar and putchar. Anyway, you can look at a solution if you can't figure it out.
• 11-24-2005
quzah
Since we've been having such a fine discussion on recursion, here's the challenge:

Generate a N x N maze using the following methodology for creation:
1 - Input a starting point, Y and X, where Y and X are in bounds for the maze.
2 - From the starting point, visit every other cell in the maze, you should use the following methods for moving:
-- If any neighboring squares are unvisited, pick one of them at random, and go there.
-- The act of moving there will remove the "wall" between the two cells. You may keep track of the "walls" however you like. The common method is to use a bit of masking, pardon the pun, to denote if a wall exists or not. A cell whose value is zero means it's unused. However, you can use any method to keep track of where you've been you choose.
-- If you reach a point where all neighboring cells are visited, you should begin backtracking your path to find a neighboring cell that isn't visited, and begin the process again.
-- When all rooms have been reached, you are to done.
3 - Implement the above method using recursion.
4 - Implement the above method without using recursion.
5 - You should have a method for printing your maze to the screen, or file, in the event it's too large. A maze might look like this:
Code:

+--+--+--+--+--+
|    |  |  |  |
+--+  +  +  +  +
|  |    |    |
+  +  +--+  +--+
|    |><|    |
+--+  +  +--+  +
|              |
+  +--+  +--+  +
|  |        |  |
+--+--+--+--+--+

It might, but you can make it however you like. That was just an example of a possible 5x5 maze. You could also denote the starting point, just as a point of interest. I did here with "><", because after all, X marks the spot.

If you're bored, also do the following:

1 - Given one of these generated mazes, enter a starting point and a finishing point.
2 - Implement a recursive method for finding the finishing point, using the above rules for generation. However in this case, you don't remove any walls, you simply go there. You'll need to keep track of your progress, so you can backtrack effectively.
3 - Implement an iterative version of the same pathing.

Quzah.
• 11-25-2005
GavinHawk
I am completely new at programming and am teaching myself because of not being able to attend school for it at this time. I like giving myself my own homework because it's fun and makes me feel like I'm actually in school again. Anyway, I created a project program that is REALLY simple. It's a zodiac generator. You enter in the month (i.e. 2) and the day (i.e. 26) and it gives you your zodiac sign (i.e. Pisces). It's pretty cool. :)
• 11-25-2005
bobthebullet990
do the hello world program!!!!!!!! :confused:
• 11-25-2005
bobthebullet990
Quote:

Originally Posted by GavinHawk
I am completely new at programming and am teaching myself because of not being able to attend school for it at this time. I like giving myself my own homework because it's fun and makes me feel like I'm actually in school again. Anyway, I created a project program that is REALLY simple. It's a zodiac generator. You enter in the month (i.e. 2) and the day (i.e. 26) and it gives you your zodiac sign (i.e. Pisces). It's pretty cool. :)

Try this for starting out in C....

General I/O
write RAWBIT PGM files
write RAWBIT PPM files
write RAWBIT PBM files

Point Operations
RGB to grescale conversion
gamma correction

Area Operations
Sharpen
Edge Detect
Geometric Operation
Rescale
Minification Using Median Substitution

Frame Operations
Image Subraction

....OH how fun my 1st year of uni was!!! ...this was for module image processing in C, coursework was to produce a library of the above functions!

But this was first year and i had never ever even seen a c program! I only ever used VB, so you can imagine the jump i needed to take!!!! NOT FUN!

This module is now obselete though because too many people failed!!!! ...if you want to learn C, try some of this!!! ...the website for this module is still there!!! ...the address is:

If you want to learn more advanced C quickly, the best thing is to be thrown right in at the deep end! ...it actually works! I had never ever touched C, at the beginning of the year, i was just getting to grips with C structure and layout, writing hello world to the screen!!!! ....In first year of uni, we had to write an image processing library of functions!!! FUN! ...but it is awesome if you want to learn about image processing and learn to program in C!

The module notes are still on the web, so if you fancy learning C, there is no better way, this really gets you in at the deep end!!! Trust me, i was there, i did it, and i learnt C!!!! although for the first few months i was the most confused person in the world!!!!!!!! well, here is the address for the site:

http://www.cems.uwe.ac.uk/~irjohnso/uqc146s1.html

...my library of functions ended up totalling around 2,000 lines of code!!!!! so i am sure you can imagine how fun my course is at uni!!!!! ...Computing for real time systems and embedded systems programming
• 11-25-2005
gunder
Thanks for the suggestions, I really like the histogram and the maze. Those are things that are interesting to do but not too complicated. Thanks again.