I have no idea how to convert integers, doubles, floats etc... to strings. Can anyone help? I thought maybe casting might do it...I googled the "string class" for C++ but it makes no mention of what I'm trying to do. Has a lot of useful information though. I also thought simply using string = int would do it, but no luck. Are those functions atoi() or itoa() my only option??
Code:#include <iostream> #include <stdlib.h> #include <string> using namespace std; int main () { string test; int num = 5; double num2 = 10.5; test = (string)num; cout << test; test = (string)num2; cout << test; return (EXIT_SUCCESS); }