All pastes #200414 Raw Edit

Anonymous

public text v1 · immutable
#200414 ·published 2006-10-13 04:16 UTC
rendered paste body

// in convert.h
double convertToDouble(const string& s)
 {
   istringstream i(s);
   double x;
 
   i >> x; 
   return x;
 }

// in number.cpp
double x = convertToDouble( strInput );
cout << x + 10 << endl;  // for testing

/** I tried this with no luck: **/
// in convert.h
double convertToDouble(const string& s)
 {
   istringstream i(s);
   double x;
 
   for ( j = 0; j < 5; j++ )
     i >> x; 

   return x;
 }
// and also tried while looping it. I is not an array, so how do I advance it?