#include <iostream>
#include <string>
...
#include <iostream>
using namespace std;
...
using namespace std;
const string COMPUTER_ITEM_1 = "blanket";
const string COMPUTER_ITEM_2 = "jar of jam";
const is called a reserved word.
string is a data type.
= is the assignment operator
"blanket" and "jar of jam" are string literals
...
const string COMPUTER_ITEM_2 = "jar of jam";
int main() {
cout << "The first computer item is " << COMPUTER_ITEM_1 << endl;
cout << "The second computer item is " << COMPUTER_ITEM_2 << endl;
return 0;
}
main routine.
int is another data type.
cout represents the terminal, where we will write the output.
<< is the stream insertion operator.
"The first computer item is " is another string literal.
COMPUTER_ITEM_1 and print it to the output.
endl prints a new line (enter key sort of)
return is a reserved word which means end the function that is currently executing.