Edmund Rojas
Edmund Rojas

Reputation: 6606

c++ stringstream concatenating string variables with integers and literal strings

A bit new to c++ and attempting to concatenate variables of differing types and literal strings together to create a formatted output later, however I keep getting an error once I add in any literal strings with quotes such as "This in quotes" etc, below is my code of how I attempted to do it, any help will go a long way

 string format;

 std::stringstream stream;
 stream << "Work Ticket # "<< workTicket << " "<< clientNumber << "(" <<labDay << "/"<     labMonth << "/"<< labYear <<") : "<< labDesc;
 format = stream.str();

Upvotes: 0

Views: 1302

Answers (1)

DennisL
DennisL

Reputation: 476

There appears to be a typo in your code:

...labDay << "/"<     labMonth...

should read

...labDay << "/" << labMonth...

Whats's your exact error message?

Upvotes: 1

Related Questions