yes but these little optimisations, offer also hints about how to think.I talked with him before about another homework and I've said that I will never offer him the full code because this way he will not learn any thing.
The most important is to learn to think.Learning programming does not mean to learn a new programming language and to know a lot of them and finally knowing to do nothing when it comes to a problem.
As I know from past messages he knows or at least said to know vb.If I were him I would try to write a vb program for this problem and after to put it in c++ to see the diferences, similarities etc.
----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Sunday, August 16, 2009 4:07 PM Subject: RE: prime numbers question
*smile*, this is actually a very minimal optimization ... There is a farbetter, and just as easy, optimization, but I was trying to specifically not say it until we receive some responses, per hapse some attempts at code, andso on. *smile* Take care, Sina -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Chris HofstaderSent: Sunday, August 16, 2009 8:55 AM To: programmingblind@xxxxxxxxxxxxx Subject: Re: prime numbers question One optimization to Sina's description is that you can automatically eliminate all even numbers as all are divisible by 2. On Aug 16, 2009, at 8:46 AM, Sina Bahram wrote:Start by defining what a prime number is ... I'm going to assume you know some of this, but I won't give the full answer here. Very rough, non-mathematical definition: A prime number is any number greater than 1, which is evenly divisible by only itself and 1. The first few are: 2, 3, 5, 7, 11, 13, 17, 19, 23, and so on. So if I was a computer, and I'm given a number, I have to figure out if it is evenly divisible by only itself and one. How would I go about finding out what a number is evenly divisible by? Hint: Evenly divisible is another way of saying that when you divide a number by a divisor, the remainder is 0. If this was in print, I would have underlined the word remainder. Hope this puts you on the right track? Take care, Sina -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Marvin Hunkin Sent: Sunday, August 16, 2009 8:14 AM To: programmingblind@xxxxxxxxxxxxx Subject: prime numbers question hi. have to do a assignment in cz++. where you enter a number. then it will spit out if it is a prime number or a composite number. any ideas how i code this. cheers Marvin. E-Mail: startrekcafe@xxxxxxxxx Msn: startrekcafe@xxxxxxx Skype: startrekcafe to subscribe to the Jaws Australia group send a blank message to JawsOz-subscribe@xxxxxxxxxxxxxxx Visit my Jaws Australia Group at http://groups.yahoo.com/groups/ JawsOz/ __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind