int i = 0;
if(i >= 0)
{
cout << i << endl;
}
bool ShouldContinue = true;
while(ShouldContinue)
{
ShouldContinue = false;
cout << "hi!" << endl;
}
int n = 6;
if(isDivisibleBy2(n))
{
cout << "divisible by 2" << endl;
}
else if(isDivisibleBy3(n))
{
cout << "divisible by 3" << endl;
}
What are the things between the parentheses called?
int sum(int n1, int n2)
int i = 0;
do
{
cout << i << endl;
++i;
} while(i < 3);
string movie = "Sleepy Hollow";
if(movie == "sleepy hollow")
{
cout << "found it" << endl;
}
int i = 3;
do
{
cout << i << endl;
--i;
} while(i > 0);
string movie = "Terminator";
if(movie == "Terminator") && movie.find("Term") != string::npos)
{
cout << "found it" << endl;
}
What are lines of code that begin with // called?
e.g.,
// what are these called?
for(int i = 0 ; i < 5; ++i)
{
cout << (i + 1 * 2) << endl;
}
string movie = "Lord of the Rings";
string userMovie = "lord";
if(movie == userMovie)
{
cout << "case 1" << endl;
}
else if(movie.find(userMovie) != string::npos)
{
cout << "case 2" << endl;
}
else
{
cout << "else" << endl;
}