All pastes #115411 Raw Edit

Someone

public cpp v1 · immutable
·published 2006-08-04 15:35 UTC
rendered paste body
float stringToFloat (string s){	for (unsigned int i = 0; i < s.length (); i++)		if (!isdigit (s[i]) && (s[i] != '.') && (s[i] != ',') && (s[i] != '+') && (s[i] != '-'))			throw BadInput ((std::string ("Cannot convert character: ") + s[i] + " in " + s).c_str ());	stringstream fss;	fss << s;	float f;	fss >> f;		return f;}string floatToString (float f){	std::ostringstream buf;	buf.precision (2);	buf << fixed << f;	return buf.str ();}