PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : float Wert in einem String speichern mit dem Dev-C++ Compiler


Lord Nikon
2004-06-26, 15:47:01
Hi,
hier mein Code

float time=((float)(t2-t1)/CLOCKS_PER_SEC);
string s="";
s=string(time);

Fehlermeldung:
no matching function for call to `std::basic_string<char,

Wie funktioniert das richtig?
EDIT:
Hab es rausgefunden.

D-Swat
2004-06-26, 19:40:46
#include <sstream>
#include <string>

float time=((float)(t2-t1)/CLOCKS_PER_SEC);
stringstream sstr;
sstr << time;
string s = sstr.str();


stringstream könnte auch in nem anderen header deklariert sein, da must du mal schaun.