Putting a Space in cout output

cout << age << "is your age.\n";

I would like put a space between age & is your age in the obove example output:

Thanks,
Chester
Hello samtheman,

All you have to to is tell it to like:
1
2
cout << age << " is your age.\n";
//              ^ space here. 

or cout << age << ' ' << "is your age.\n";

Hope that helps,

Andy
@Handy Andy already answered this question. However, you could also be using spaces like this for future purposes if you want to display spaces between variables.

 
cout << " " << age << " " << "is your age." << endl;


Where endl also substitutes \n.
Topic archived. No new replies allowed.