I am new to C ++ and I am trying to run a simple program.
I am using the Eclipse IDE (C ++ version) on a Windows system.
I am trying to concatenate an output statement, it will combine numbers and strings.
I know in Java, this was done automatically using the System.out.println () method.
What I was able to research was a good way to implement this in C ++ - use the string stream method.
#include <iostream>
#include <string>
#include "Person.h"
...
string simpleOutput(){
stringstream ss;
int a = 50;
int b = 60;
string temp = "Random";
ss << a << b << temp;
return string output = ss.str();
}
When I try to compile this code, we get the following: The str method cannot be resolved.
I still need to find a solution on any web page. T Thank you!
source
share