Array of Char to String Conversion in C++

This Program converts an array of char into string in C++ program. The most simple way to convert an array of char into String is that just assign the value of array to string and it will be converted into string.

Source Code

#include<iostream>
using namespace std;
int main ()
{
 cout<<"\t \t \t LEP Tutorials \n \n \n ";
 char LEP [200] = " This is Array of Char \n ";
 string s ;
 s = LEP;
 cout<<s<<endl;
}

Output of the Program

Array of Char to String Conversion in C++

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment