Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13572
| From | Gareth Owen <gwowen@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: loops |
| References | <70285e31-38eb-47b4-8474-84db67c32fdc@k6g2000vbz.googlegroups.com> |
| Date | 2012-01-25 06:09 +0000 |
| Message-ID | <87ehuo8g9k.fsf@gmail.com> (permalink) |
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
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