1: #include <iostream>
   2: #include <string>
   3: #include <sstream>
   4:
   5:
   6: using namespace std;
   7:
   8: template <typename Number>
   9: void
  10: String_To_Number( std::string & outstring, const Number number )
  11: {
  12:     ostringstream outstream;
  13:     outstream << number;
  14:     outstring += outstream.str();
  15: }
  16: 
  17: int main( void )
  18: {
  19:     unsigned int age = 233;
  20:     string turtle = "The age of my turtle Dolly is ";
  21:     String_To_Number( turtle, age );
  22:     turtle += ".";
  23: 
  24:     cout << turtle <<  endl;
  25: 
  26:     long years = 500000000;
  27: 
  28:     string star = "This star chrashed into the sun ";
  29:     String_To_Number( star, years );
  30:     star += " ago.";
  31: 
  32:     cout << star << endl;
  33: 
  34:     double meter = 5.78;
  35: 
  36:     string room = "This room is ";
  37:     String_To_Number( room, meter );
  38:     room += " meters high.";
  39: 
  40:     cout << room << endl;
  41: 
  42:     unsigned short midday = 12;
  43: 
  44:     string lunch = "We have lunch at ";
  45:     String_To_Number(  lunch, midday );
  46:     lunch += " a.m.";
  47: 
  48:     cout << lunch << endl;
  49: 
  50: 
  51:     string example = "That were exactly ";
  52:     String_To_Number( example, 4 );
  53:     example += " examples.";
  54: 
  55:     cout << example << endl;
  56: 
  57: 
  58:     return 0;
  59: }
  60: