C++ FUNdimentals Flashcards
(24 cards)
What is the “Entry Point” function for C++
the main() function
int main()
{
}
What is a function?
A function contains a series of instructions. When the function is run each of the instructions is carried out from first to last.
What is the function header?
Contains the name of the function
What is the Function body?
Contains all the function commands
How do you finish a code statment in C++
It has to end in ; or the computer won’t recognize it.
Programmers create libraries that are fille with completed functions. How to you add them to your program?
include <partyLibrary></partyLibrary>
Using the #include directive
How do you call a function?
by putting the name of the function ending with();
How do you input strings in the printf(); function?
Using “ “ around the text you want to have entered
How do you write a comment in C++?
/* comment */
You can do multiple lines by doing:
/*
*hello
*goodbye
*/
what are the two different kinds of files that #include uses?
<> and “”
The angle brackets are ones that have been created and are built into the language.
the quotes are external libraries and have to be downloaded.
They have the proper header file extension called .h
How do you initialize a window pop up using the raylib.h library?
using the function initWindow();
How do you initialize a window pop up using the raylib.h library?
using the function initWindow();
Some functions have multiple paramaters. (think excel. Separated by commas)
VERY IMPORTANT
What parameters does InitWindow require?
InitWindow(width, height, title);
What is an Integer?
A whole number
1, 75, -100
What does the Type of data do?
Determines how the data is stored
integer
double
float
etc.
Variables have three parts, what are they?
Name
Value
Type
numberOfCookies
9
int
int numberOfCookies;
numberOfCookies = 9;
How do you declare a variable?
by writing its data type and then the variable name
int numberOfCookies;
How many decimals can a float hold?
6-7
How many decimals can a double hold?
15-16
What is the difference between a float and a double?
A float uses less decimals, which means less accuracy but also uses less memory.
What is a boolean?
A true or false statement
What is braced initialization?
Declaring a variable using the {}
double cheese_burger{1.99};
What is the == comparison operator?
It compares the value on the left to the right
bool fourIsNine;
fourIsNine = (5==9);