topical media & game development

talk show tell print


? / basic-program-solutions-03-Soln3-4.c

  // Soln3_4.cpp
  include <iostream>
  using std::cout;
  const int text = 0x01;
  const int binary = 0x02;
  const int read = 0x10;
  const int write = 0x20;
  const int append = 0x30;
  int main()
     int mode = text | read;
     if (mode & text)
        cout << "mode is (text,";
     else if (mode & binary)
        cout << "mode is (binary,";
     if (mode & read)
        cout << "read)\n";
     else if (mode & write)
        cout << "write)\n";
     else if (mode & append)
        cout << "append)\n";
     return 0;

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.