Re: Summary of loops
From: Clara (claradona_at_hotmail.com)
Date: 02/23/05
- Next message: santosh: "greedy method"
- Previous message: Maxim Kasimov: "task sheduling"
- In reply to: Anthony Borla: "Re: Summary of loops"
- Next in thread: Anthony Borla: "Re: Summary of loops"
- Reply: Anthony Borla: "Re: Summary of loops"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Feb 2005 03:58:11 -0800
"Anthony Borla" <ajborla@bigpond.com> wrote in message news:<qiPSd.171631$K7.29083@news-server.bigpond.net.au>...
> "Tilman Bohn" <myfirstname@gmx.net> wrote in message
> news:slrnd1mjcf.8o5.myfirstname@urizen.tilmanbohn.com...
> > In message <421b445a$0$12384$3b214f66@tunews.univie.ac.at>,
> > Daniel Tahin wrote on Tue, 22 Feb 2005 15:40:26 +0100:
> >
> > > Anthony Borla wrote:
> > [...]
> > >> for (int i = 0; i < MAX_ITERATIONS; i++)
> > >> {
> > >> ...
> > >> sum += ...;
> > >> ...
> > >> }
> > >>
> > >> double average = sum / i;
> > [...]
> > >
> > > There is only a bit problem:-) i is declared in the body of
> > > for(), so it's accessible only in it.
> > > If you want to reach it outside for(), you should declare
> > > it above for()!
> > >
>
> Sshhh - don't spoil the surprise ;) !
>
> >
> > I suspect he left the error as an exercise for the reader
> > (because he didn't want to do someone else's homework)
> > -- however, you've spotted the wrong error (or the wrong
> > fix if you prefer).
> >
>
> I'm hoping the post works like this:
>
> * Student Googles for 'Calculating an Average' [the
> reason behind changing the subject name was to
> make it more easily found in archive searches]
>
> * Post found - contains relevant Java code
>
> * Attempt to utilise code is made, *but*, it doesn't
> quite work ! Hopefully *now* the learning begins
>
> Who said homework was meant to be easy ;) !
>
> Cheers,
>
> Anthony Borla
Haha thanks a lot but it wasn't a piece of homework. I'm helping my
dad write and test out a program though I'm not trained in this
language. I thought I'll ask this qn cos I needed info on this as well
:)
- Next message: santosh: "greedy method"
- Previous message: Maxim Kasimov: "task sheduling"
- In reply to: Anthony Borla: "Re: Summary of loops"
- Next in thread: Anthony Borla: "Re: Summary of loops"
- Reply: Anthony Borla: "Re: Summary of loops"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|