I want to create a text on a window. I am using the built in FLTK and GUI C++ libraries from Stroustrup's programming website. One of the classes he has built in is the Text class inherited form class Structure.
The general formula for attaching text on the window is:
Text x(Point(100,100),"Hello");
window.attach(x);
However, I would like to attach a saved integer that the user inputted before, such as age. I have tried the following but it does not compile:
Text x(Point(100,100),"Hello, you are " << age << " years old");
window.attach(x);
Thank you.
You can use std::to_string since c++11:
Text x(Point(100,100),"Hello, you are " + std::to_string(age) + " years old");
Include string header.