combining data

I am really new to c programming and c++. I am currently trying to write a program and I am having trouble. I have three variables. One is a floating variable, one is an integer, and the last is a character. I can not figure how to combne them into a single string. Any help would be greatly appreciated
Last edited on
With stringstreams
eg:
1
2
3
4
5
6
7
8
float f = 123.456;
int i = 789;
char c = '!';

stringstream ss; // #include<sstream>  for this
ss << f << i << c;

ss.str(); // returns a std::string containing "123.456789!" 
Topic archived. No new replies allowed.