loading...

how to convert string to char c++ ?

pakainfocom profile image pakainfo ・1 min read

Today, We want to share with you convert char to string c++.In this post we will show you char to string c++, hear for c++ string we will give you demo and example for implement.In this post, we will learn about char to int with an example.

1. std::string constructor

easy way to solution will be to use data string class fill data c++ constructor transform your main string (size_t n, char c); which fills the string with n copies of character c.

include

include

int main()
{
char c = 'A';

// apply string class fill c++ constructor transform

std::string s(1, c);
std::cout << s << '\n';

return 0;

}

You can visit my Article with More Examples : click here

Posted on by:

pakainfocom profile

pakainfo

@pakainfocom

My name is Angular King. I'm a full-stack developer, entrepreneur and owner of Pakainfo. I live in India and I love to write

Discussion

markdown guide