how to print out a variable in a string c++ code example Example: c++ print variable cout << x; cout << "X is: " << x << endl; //endl is to end the line