Ha! What's the old quote? "Lack of planning on your part does not constitute an emergency on my part."
@tagir: This is very easy to code. You must have something at this point. Post it here so we can see you're trying and help you complete it. We won't do your homework for you though.
@Kizlbot and hackthisred While I am sure you mean well in providing that code, it is ultimately more educational for everyone if we merely give suggestions instead. I hate to say it but posting solutions to people's homework will not make you any friends on here :/
Please don't take this personally - it's just a heads up :D
Thanks Xander314, but I was a very visual or learn by example individual... I always found it easier to understand a concept by actually seeing a working example... NOT by people giving me riddles in a subject I don't have a total handle on... but thanks for the heads up
No problem :) To be honest I am probably one of the people who gives riddles for fear of spoon feeding...
As code goes, yours is pretty good. Some people actually give code samples which are riven with bad coding practise (you haven't :) ), which is understandably frowned upon.
What you said is of course correct - people learn in different ways and to be honest, had you just added one or two comments I doubt I'd have said anything at all.
This "If you just SHOW me how to do it, I'll LEARN how to do it" idea is wishful thinking at best.
Can you read a bunch of novels and then sit down and write one?
How much time do you have to spend in museums before you can paint?
Will a years worth of MTV make you a Guitar Hero???
A good example that's EXPLAINED WELL will bring you up to speed on a general concept. But after that:
If you want to be a writer, write a lot.
If you want to be a painter, paint everything you see.
If you want to get to Carnegie Hall, practice, practice, practice.
And if you want to be a good programmer, code your brains out!!
Also don't forget that half of programming is critical thinking and the only way to develop that skill is to solve problems. Insight can't be taught, only learned. (Otherwise it would be called "outsight")
@Xander314, generally people new to the forum give full solutions with code to motivate themselves but with time they learn that we are not here to do homework. :)
Newbies are also often very excited about what they have just learned and want to show off their new knowledge. You can't blame them for that, it's just human nature. I wish they would at least comment their solutions well and try to explain how and why they solved the problem the way they did. That way both sides would potentially learn something. I say potentially because I suspect most recipients of the free solution just put their name on it and hand it in (more beer drinking time, WooHoo!).