// A2_2.cpp #include #include #include using namespace std; template string convert(T &t) { ostringstream temp; temp << t << ends; return temp.str(); } void main() { string s1 = convert(-3); cout << "\n " << s1.c_str(); string s2 = convert(3.3333e-3); cout << "\n " << s2.c_str() << "\n\n"; //// things tried on some of your exams /////////////////////// // int i = 3; // char ch = static_cast(i); // not digit 3 // string s = static_cast(i); // won't compile // char ch = reinterpret_cast(i); // won't compile /////////////////////////////////////////////////////////////// }