C++ – Konvertierungen

So einfach und ich habe es nirgends gefunden. Durch Zufall heute entdeckt.

Konvertierung double nach int
double test1 = 2.65;
int test2 = (int)test1;
cout << test2 << endl;

Konvertierung int nach double
int test3 = 2;
double test4 = (double)test3;
cout << test4+.5 << endl;

QString nach string
QString = Variable1
string Variable2 = Variable.toUtf8().constData()
cout << Variable2 << endl;