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


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

Re: loops

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date Wed, 25 Jan 2012 00:09:39 -0600
From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c++
Subject Re: loops
References <70285e31-38eb-47b4-8474-84db67c32fdc@k6g2000vbz.googlegroups.com>
Date Wed, 25 Jan 2012 06:09:43 +0000
Message-ID <87ehuo8g9k.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:mIKPAnlecsUs++BxP6s0z6tkNXg=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 17
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-Cvv6A167ezX0lKBB/QwH45poD8EhH00dkjw+4MWgc4LLXlhIc1vjbZu3u7gPxz/JeHb+Ko6qvi2TQIe!LPZS2JwhLPE3YPs+S1iyu7koH6otxY0Nc1mKd4Ovdq0ioy0w0fJKvzH8UIP1oEme/Sw=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1417
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:13572

Show key headers only | View raw


ahso <ahso47@yahoo.com> writes:

> Hi
> i get z values by feeding/incrementing x and y. So i have for ex.
> 1-1386 z values and the question how to output those to a field of
> 128x128? (x/y)
> Many thanks

// Although obviously y won't get up to 128 unless you use
// z <= 16384

for(unsigned z = 1;z <= 1386;++z){
  unsigned x = ((z-1) % 128) + 1;
  unsigned y = ((z-1) / 128) + 1;
  // Do what you need with x,y
  ...
}            

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


Thread

loops ahso <ahso47@yahoo.com> - 2012-01-24 06:25 -0800
  Re: loops Victor Bazarov <v.bazarov@comcast.invalid> - 2012-01-24 10:53 -0500
  Re: loops Gareth Owen <gwowen@gmail.com> - 2012-01-25 06:09 +0000
  Re: loops "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2012-01-25 09:52 +0100
    Re: loops ahso <ahso47@yahoo.com> - 2012-01-25 01:38 -0800
      Re: loops "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2012-01-25 11:20 +0100
        Re: loops ahso <ahso47@yahoo.com> - 2012-01-25 03:24 -0800
          Re: loops ahso <ahso47@yahoo.com> - 2012-01-27 11:55 -0800

csiph-web