Thursday, 5 February 2015

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;
}

Output of the Program

Integers to string conversion in C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment