chr to string c++ code example
Example 1: char to string c++
std::cout << std::string(1, c) << std::endl;
Example 2: c++ char to string
#include <iostream>
using namespace std;
int main()
{
char c = 'l';
string str;
str.push_back(c);
}
std::cout << std::string(1, c) << std::endl;
#include <iostream>
using namespace std;
int main()
{
char c = 'l';
string str;
str.push_back(c);
}