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
Discussion