Listing 4: An over-simplified version <iostream>

//              
// Metrowerk's C++ in BeOS DR8 does not have iostream.
// By including this file, you get almost complete 
// iostream functionality.
// That is, your code may contain something like
//      int d; double f;
//      cout << "Enter two numbers" << endl; cin >> d >> f;
//      cout << "The numbers are " << d << " and " << f << endl;
// and it *will* work (with this iostream included),
// without _any_ changes in your code...
// Made at a Be Dev kitchen on Dec 13, 1996 (in 5 minutes)

#include <stdio.h>

class IOSTREAM
{
};

static IOSTREAM cout, cin;

class Endl {};
static Endl endl;
class Manip {};
static Manip dec, hex;

IOSTREAM& operator << (IOSTREAM& os, const char * str)
{ printf("%s",str); return os; }

IOSTREAM& operator << (IOSTREAM& os, const int num)
{ printf("%d",num); return os; }

IOSTREAM& operator << (IOSTREAM& os, const unsigned long num)
{ printf("%d",num); return os; }
// the same for 'const long num',  'const unsigned int num', 
// 'const float num', 'const double num', etc.
// primitive number types

IOSTREAM& operator << (IOSTREAM& os, const Endl& _endl)
{ puts(""); return os; }

IOSTREAM& operator << (IOSTREAM& os, const Manip& manip)
{ return os; }

IOSTREAM& operator >> (IOSTREAM& os, int& num)
{ scanf("%d",&num); return os; }
// similar for 'double& num', etc.

//End of File