Hi all,

I have what I think should be a simple C++ question.

What is the simpler way of writing this:

  int b = a;
  if ((b & C)==C)
  {
    b = b - C;
  }

  switch (b)
    ...

My first stab at this was

  switch (a | !C)

but that doesn't do what I think it should.

Oh..  Nevermind.  I forgot that the bitwise NOT operator is ~ not !.

I'm posting this anyway since all the best discussions start with questions that google can answer in less time than it takes to writa post to a mailing list.

Continuing the theme of not googling things, how would I do this in Python?

Adelle.

_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to