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 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> 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 ahso 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 ... }