$\require{cancel}$
strings
#include <string>
const string SALUTE{"Hello "};
SALUTE
string
const
marks it as constant.
{"Hello "}
initializes the constant to the string Hello
"Hello "
is a literal string constant.
const type identifier{expression};
const type identifier = expression;
int main() { string name, greeting;
name
and greeting
type identifier = expression [,identifier = expression ...];
string name = "", greeting = ""; string word1 = "Hello", word2 = "World"; string firstName = "Dan"; string lastName = "Bennett";
type identifier {expression}[, identifier{expression}, ...];
string name{""}, greeting{""}; string word1{"Hello"}, word2{"World"}; string firstName{"Dan"}; string lastName{"Bennett"};
greeting = SALUTE + name + "!";
SALUTE + name + "!"
is an expression
SALUTE
name
"!"
greeting