www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/14/03:22:44

From: d791013 AT hntp2 DOT hinet DOT net (d791013)
Subject: named enum?
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP list)
Date: Wed, 14 Sep 1994 14:18:26 +0800 (WST)

Hi,

   Can the named enumeration be implemented in DJGPP? For example, when
I compile the small program below:

	enum  bool  {false, true};
	void main () {
	  bool foo = false;
	}

the g++ told me:
	
	temp.cc:1: parse error before `bool'.


  Another question is that: I want to print out the hexidecimal code
using cout, like that: (referenced to the book "The C++ Programming
Language," Bjarne Stroustrup, 2nd, p54)

	#include <iostream.h>
	void main () {
	  char ch;
	  while (cin >> ch)
	    cout << hex(ch);
	}

and it did not work. After that I use the following codes:

	#include <iostream.h>
	const  MASK = 0xff;
	void main () {
	  char ch;
	  while (cin >> ch)
	    cout << hex << (MASK & ch);
	}

then it fits I want.

Any comments about the above questions? Thanks in advance.

Regards,
Chun-Yu Lee
d791013 AT c2 DOT hinet DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019