1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
What is a computer?
A general purpose binary state machine made up of electronic components capable of input-process-output.
What are the digits in binary?
0’s and 1’s
What is the base number for hexadecimals?
16
What are the valid digits of hexadecimals?
1-9 and A-F (10-15)
How to convert decimals to hexadecimals?
Keep dividing the number by 16
Take the amount of times the number can go into the original number and divide it again by 16.
Take the remainders of the number from bottom to top as the final number.
What are the 3 control sequences of a structured program?
Simple Sequence
Decision/Selection
Repetition/Iteration
When do you use for loops in C?
Use for loops when you know how many times you want the code to loop.
When do you use while loops in C?
When you do not know how many times the loop will loop. It is usually paired with a condition.
When do you use a do-while loops in C?
Use when you want to ensure the body code to run at least once even if the condition is false.
What is an array?
A variable to holds multiple things in one structure.
What number does the first item in the array starts at?
0
What are command line arguments?
Passing information to the program without prompting the user in the code.
How to write start the command line?
int main (int argc, string argv [])
What does argc do in the command line?
Counts the number of elements are in the argv.
What does argv [] do?
It is where the elements from the command line go to as an array?
What is element 0 in the argv[] array?
It is the name of the program (./programName)
What does Return 0/continue mean?
A integer that gives no errors to the user.
What does return 1/break mean?
There is an error in the input and it kills the code. It’s used to stop code if the command line doesn’t have enough arguments
How do you format a function header?
At the top of the code before the int main () and after importation of any libraries.
returnType functionName (formal parameters);
float CalculateNetPrice (float original, float taxRate );