int, double, char, string, etc. are examples of this?
What is variable type?
The modulus operator uses this symbol.
What is %?
int main () {
cout >> "What's your name? ";
}
What is << ?
The line that includes the SFML library.
int main() {
for (int i = 1; i <= 5; ++i) {
cout << i << " ";
}
return 0;
}
What is 1 2 3 4 5 ?
The value 3. would be this variable type.
What is a double (or float)?
Used to repeat a specific block of code a known number of times.
What is a for loop?
for (int i = 1; i++; i <= 5) {
cout << i << " ";
}
What is (int i = 1; i <= 5; i++;)?
Line of code needed when you don't want to continuously type "sf::"?
What is using namespace sf; ?
string line = "Look at me, I can write C++ code!";
cout << "Hey! " << line << endl;
What is Hey! Look at me, I can write C++ code! ?
A variable type that contains a variable enclosed within single quotes (as opposed to double quotes).
What is a char?
The increment operator in C++.
What is ++?
int main() {
cin >> x;
cout << x;
}
What is declaring variable?
You have a shape called Circle. You fill the shape with the color white.
What is Circle.setFillColor(sf::Color::White); ?
int i = 3;
while(i>0) {
cout << i << endl;
--i;
}
What is:
3
2
1
If I have an int called 'n', use this command to read the integer from the user. (Hint: c??)
What is cin >> n; ?
This represents the AND logical operator for conditional statements in C++.
What is &&?
void menu();
int main()
{
//...
menu();
}
void menu();
{
//...
}
What is extra semicolon? (line 7)
Command used when you want to display a variable called background on the SFML window. (Hint: draw something on the window)
What is window.draw(background); ?
for(int i = 0 ; i < 3; ++i)
{
cout << (i * 2) << endl;
}
What is:
0
2
4
A variable that holds a memory address.
What is a pointer?
Dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted.
What is a vector?
char done = 'Y';
while (done = 'Y') {
//...
cout << "Continue? (Y/N)";
cin >> done;
}
What is == ? (in while loop condition)
You have a texture called "Bob". You want to load the "bob.png" file to this texture. bob.png is in your folder named "images".
What is Bob.loadFromFile("images/bob.png"); ?
string movie = "Terminator";
if((movie == "Terminator") && movie.find("Term") != string::npos)
{
cout << "found it" << endl;
}
What is found it?