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


Groups > comp.lang.c > #162390

I have a confession to make...

From Vir Campestris <vir.campestris@invalid.invalid>
Newsgroups comp.lang.c
Subject I have a confession to make...
Date 2021-08-15 22:14 +0100
Organization A noiseless patient Spider
Message-ID <sfc03t$r91$1@dont-email.me> (permalink)

Show all headers | View raw


I've been writing C, and more lately C++, since some time in the 1980s.

I've just written a goto. I know it's evil, and I shouldn't do it, but 
just this once...

And it isn't in any of the serious stuff I do in may day job either.

You all know what a magic square is - a square where all the columns, 
rows, and diagonals add up to the same value.

I'm messing about doing it for a cube. Wikipedia says you can't for 
small cubes.

I have a square for the base, and a centre value, and therefore I can 
work out all the values for the top square as they are on diagonals with 
one of the bottom values and the centre one.

I therefore have 3 nested loops: centre value, X and Y coordinates.

And if I don't like the result I jump out of the X Y loops. Which is 
where I have that goto.

Andy
-- 
(I just felt I had to tell someone!)

Back to comp.lang.c | Previous | NextNext in thread | Find similar | Unroll thread


Thread

I have a confession to make... Vir Campestris <vir.campestris@invalid.invalid> - 2021-08-15 22:14 +0100
  Re: I have a confession to make... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-08-15 14:44 -0700
    Re: I have a confession to make... Thiago Adams <thiago.adams@gmail.com> - 2021-08-15 15:56 -0700
      Re: I have a confession to make... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-08-16 01:50 +0100
  Re: I have a confession to make... Bart <bc@freeuk.com> - 2021-08-16 00:18 +0100
  Re: I have a confession to make... DFS <nospam@dfs.com> - 2021-08-15 20:31 -0400
  Re: I have a confession to make... David Brown <david.brown@hesbynett.no> - 2021-08-16 08:20 +0200
    Re: I have a confession to make... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-08-15 23:21 -0700
    Re: I have a confession to make... Vir Campestris <vir.campestris@invalid.invalid> - 2021-08-17 21:43 +0100
  Re: I have a confession to make... Mark Bluemel <mark.bluemel@gmail.com> - 2021-08-16 00:32 -0700
    Re: I have a confession to make... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-08-16 14:21 +0100
      Re: I have a confession to make... Bart <bc@freeuk.com> - 2021-08-16 17:48 +0100
      Re: I have a confession to make... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-09-06 06:30 -0700
        Re: I have a confession to make... David Brown <david.brown@hesbynett.no> - 2021-09-06 18:04 +0200

csiph-web