Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #12078

Re: nested for/while loops

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: nested for/while loops
Date 2011-12-05 11:59 -0500
Organization A noiseless patient Spider
Message-ID <jbit92$gu9$1@dont-email.me> (permalink)
References (1 earlier) <c2b7db78-ee53-4387-8d10-cbc50c2c521c@o1g2000vbe.googlegroups.com> <jbgbd7$253$1@dont-email.me> <55672f9a-f147-48f8-9c0d-8ffe6d4e3c7f@n6g2000vbg.googlegroups.com> <f99221d1-921e-4274-a624-e1c5a645912b@c13g2000vbh.googlegroups.com> <31ef277e-863c-42fa-82b8-3e2b238d3866@t16g2000vba.googlegroups.com>

Show all headers | View raw


On 12/5/2011 9:19 AM, ahso wrote:
> Getting closer, now I have lines from top left to bottom right:
>
> 	for( int x=0; x<  16384; x++ ){
> draw x,y,z
>
> I need also a y for loop?
> Thanks
> Michael

Michael,

You need to sit down and write your algorithm with a pencil on a piece 
of paper.  "I have lines from top left to bottom right" - what does that 
mean?  We have no idea.  It's not a description of an algorithm. 
Perhaps you need to think about the algorithm for a while.  Perhaps you 
should also look into some *formality* in your activities.  So far your 
posts indicate that your work is very hap-hazard.  Step back from 
programming for an hour and think what actions you would take if you 
were the computer and you needed to accomplish whatever goal you're 
setting for it.

To make tea, what do you need?  You need a cup, water source, dry tea 
(loose or in a bag) and a way to heat the water to the boiling point. 
Water source is in the kitchen (or the bathroom).  So, as part of the 
algorithm for making tea you need to ensure you're in one of those 
locations.  To boil water you need some energy source.  A microwave 
would do (make sure it's plugged into an electrical outlet).  And so on. 
  You write down preconditions, then you write down your actions.  It 
becomes the algorithm for accomplishing your goal.

Same thing with making calculations.  Or drawing a shape.  Or 
controlling a nuclear reactor.  You need the algorithm first, THEN you 
can put it in terms of the language you've chosen to implement it.

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

nested for/while loops ahso <ahso47@yahoo.com> - 2011-12-04 07:04 -0800
  Re: nested for/while loops ralph <nt_consulting64@yahoo.net> - 2011-12-04 10:32 -0600
  Re: nested for/while loops Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-04 09:23 -0800
    Re: nested for/while loops Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-04 12:41 -0500
      Re: nested for/while loops ahso <ahso47@yahoo.com> - 2011-12-04 22:56 -0800
        Re: nested for/while loops Werner <werasm@gmail.com> - 2011-12-05 02:13 -0800
          Re: nested for/while loops ahso <ahso47@yahoo.com> - 2011-12-05 06:19 -0800
            Re: nested for/while loops Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-05 11:59 -0500
              Re: nested for/while loops ahso <ahso47@yahoo.com> - 2011-12-05 23:07 -0800
                Re: nested for/while loops Ian Collins <ian-news@hotmail.com> - 2011-12-06 20:15 +1300
                Re: nested for/while loops Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-06 01:37 -0800
                Re: nested for/while loops ahso <ahso47@yahoo.com> - 2011-12-06 05:02 -0800
                Re: nested for/while loops "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2011-12-06 16:13 +0100
                Re: nested for/while loops Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-06 10:24 -0500
            Re: nested for/while loops Werner <werasm@gmail.com> - 2011-12-06 00:03 -0800

csiph-web