/* -*- C++ -*- */ /************************************************************************* * Copyright(c) 1995~2005 Masaharu Goto (root-cint@cern.ch) * * For the licensing terms see the file COPYING * ************************************************************************/ /********************************************************************* * ostream.c * * output stream test *********************************************************************/ #ifdef __hpux #include #else #include using namespace std; #endif // important class complex { public: double re,im; complex(double a=0.0, double b=0.0) { re=a; im=b;} }; ostream& operator <<(ostream& ios,complex a) { ios << '(' << a.re << ',' << a.im << ')' ; return(ios); } int main() { char c='a'; unsigned short b=255; const char *pc="hijklmn"; //unsigned char *pb=(unsigned char*)255; short s=0xffff; unsigned short r=0xffff; //short *ps=(short*)0xffff; //unsigned short *pr=(unsigned short*)0xffff; int I=3229; unsigned int h=0xffffffff; //int *pI=(int*)3229; //unsigned int *ph=(unsigned int*)0xffffffff; long l=-1234567; unsigned long k=15; //long *pl=(long*)-1234567; //unsigned long *pk=(unsigned long*)15; double pi=3.141592; float f=3.14; double d=-1e-15; //float *pf=(float*)314; //double *pd=(double*)-115; complex C(1.5,2.5); cout << "I=" << I << " pi=" << pi << '\n'; cout << "(complex)C="<