Variables
Variables are used to store values. A variable must have a type. The type we use for storing text is std::string
.
This line defines an std::string
variable called name
and initializes the value to "Tom"
.
std::string name{"Tom"};
The variable can then be printed using std::cout
.
Change the name from Tom
to Jerry
.
std::string name{"Tom"};
with std::string name{"Jerry"};
.