std::to_string is a quite new addition to C++. Are you using an up to date compiler? You might have to explicitly enable C++11 mode in the compiler. If you are using GCC you can do that by passing the flag -std=c++0x.
You have not said what is wrong. I can only guess that either you are using an old compiler that does not support the new C++ Standard, or you are using MS VC++ 2010. If you are using MS VC++ 2010 then you can make that your program will work: