Anything within the quotation marks is a string when you are using it with cout.
Without the quotation marks it takes names of variables and statements or even mathematical operations - (all of this as far as i know anyway, you can even cout a function and c++ will output what it returns) - and outputs the value.
#include <iostream>
#include <cstdlib>
#include <cstdio>
usingnamespace std;
int someFn(int &variable)
{
variable = 1;
return variable;
}
int main()
{
int variable = 0;
string stringA = "Meow";
// cout takes numbers at face value like so:
cout << "The number is: " << 1 << "." << endl;
// cout takes a string like the previous posts explained
cout << "The number is: " << "1" << "." << endl;
// cout takes mathematical operations like so:
cout << "The number is: " << 2-1 << "." << endl;
// more mathematical operations:
cout << "The number is: " << (1*1) << "." << endl;
// yet another mathematical operation:
cout << "The number is: " << 1/1 << "." << endl;
// cout takes variables and outputs their values,
// I'll show this here with an integer and a string already declared
cout << "The integer is: " << variable << "." << endl;
cout << "The string says: " << stringA << "." << endl;
// You can even output the return of a function by calling the function within cout !!
cout << "The result of the function is: " << someFn(variable) << "." << endl;
cin.get();
return 0;
}
There are some very creative and fun ways to mess around with cout.
Try copying that code and messing around with it until you understand all these ways you can output with cout. :)