Integers to string conversion in C++
Structure of the Problem Requirements
String stream class is used to convert an Integers to string. Just make an object of string stream class and pass integers to it.Source Code
#include <iostream> #include <sstream> int main() { using namespace std; cout<<"\t \t \t LEP Tutorials \n \n "; int num; stringstream ss; cout<<" Enter a Number : "; cin>>num; ss<<num; string str = ss.str(); cout<<endl<<endl; cout<<" The Number Converted to String : "<<str<<endl; return 0; }
0 comments:
Post a Comment