convert char to string - c++

C++
// CPP program to get a string from single 
// character. 
#include<bits/stdc++.h> 
using namespace std; 
  
string getString(char x) 
{ 
    // string class has a constructor 
    // that allows us to specify size of 
    // string as first parameter and character 
    // to be filled in given size as second 
    // parameter. 
    string s(1, x); 
  
    return s;    
} 
  
int main() { 
  cout << getString('a'); 
  return 0; 
} 

Source

Also in C++: