ok so basically i just wanted to know how to add a string variable between text..


string name;

cout << "Hello,"name"sucks";

i want to know how to do it all in one line since where i use it there are parameters and they don't allow me to make another line like cout.


Do you mean like this?

string name = "Billy Bob";
cout << "Hello " << name << " you're a wonderful person..." << endl;

yea that's what i meant but i said not only with cout.. well here's an example of where i'd like to use it.

string name;


i can't use cout style there.. so how do i use it in such parameters?

How about:

std::string message = "Error "+ name + " sucks";

ahhh! we meet again smarty pants :P

soon i shall be proer than you :)

thnx :D

ahhh! we meet again smarty pants :P

If you don't want my replies, just say the word. :icon_wink:

Nevermind, see you already have a nice answer. I guess I took too long on the response... hehehe... I was thinking you were doing command line and not a Windows GUI program so my suggestion was going to be c style printf()... but I see that's not quite what you were looking for.

#include <cstdio>
printf("Hello, %s. How are you?", "Billy Bob");


i was just messin with u...

sry if i offended you D:

sry if i offended you D:

You're going to have to try a lot harder to offend me. I was just kidding off course :)