CS110A - Test 1

Home > Preview

The flashcards below were created by user cholme14 on FreezingBlue Flashcards.


  1. argument
    arguments are data being sent to the function.

    i.e. pow(2.0,3.0)

    the 2.0 and the 3.0 are the argument
  2. cin
    cin object can be used to read data typed at the keyboard and store it in to a variable.

    i.e.

    • cout << "What is your name?";
    • cin >> name;
  3. basic requirements of a proper C++ program
    i.e.

    • // marks the beginning of a comment
    • # marks the preprocessor directive
    • using namespace std; is required to store the names of functions/variables in it
    • int main() marks the begining of a function. a function can be be thought of as a group of one or more programming statements that collectively hs a name. this is the starting point of the program
    • {} These are the opening and closing braces and mark the beginning and end of a program.
    • ; This marks the end of the line and is like a "." in English

  4. combined assignment operators
    combined assignment operators,  compound operators, and arithmetic assignment operators

    combined assignment operators allow for the abbreviation of operations like x=x+1 to x += 1

    +=, -=,*=,/=,%=/
  5. binary operator
    a binary operator performs tasks on two operands.

    i.e. +,-,*,/,%
  6. comment(single-line,multi-line,inline)
    • // marks the beginning of a single line comment
    • /* */ marks the beginning and end of a mult-line comment
    • //can be used as an inline comment
  7. bit
    the eight smaller storage location of a byte are called bits. The term bit stands for binary digit. Bits are tiny electrical components that can hold either a positive or negative charge.

    i.e. 1 and 0
  8. const
    a named constant is like a variable, but it's contents is read only and it cannot be changed while the program is running.

    i.e. const double INTEREST_RATE = 0.069
  9. bool
    The Boolean data type is used to declare a variable whose value will be set as true or false. To declare such a value, you use the bool keyword. The variable can then be initialized with the starting value.

    A Boolean constant is used to check the state of a variable, an expression, or a function, as true or false.

    bool boolValue;

    • boolValue=true
    • cout << bool Value<< endl;
    • boolValue = false;
    • cout << boolValue << endl;
    • return 0;

    • OUTPUT
    • 1
    • 0
  10. constant naming conventions
    constants are named all upper case with underscore separating words

    i.e. BACKGROUND_COLOR
  11. byte
    is a storage place in  a computer's memory and is 8 bits

    one byte can store like a letter or a digit
  12. cout
    the cout object is to display information on the to the computer's screen

    cout is a stream object

    the << is the stream insertion operator

    i.e.

    cout << "What is your name?";

    OUTPUT

    What is your name?
  13. casting
    allows for manual data type conversion

    general format of a datat type cast expression is

    static_cast<Datatype>(Value)

    i.e.

    • double number = 3.7;
    • int val;
    • val = static_cast<int>(number);

    perMonth = static_cast<double>(books) / months;
  14. data type promotion/demotion
    promotion takes a smaller data type and promotes it to a larger data type. Demotion takes a larger data type and demotes it to a smaller data type.

    for example a long double will be converted to an integer via math operators or type casting.
  15. char
    the char data type is used to store individual characters. A variable of the char data type can hold only one character at a time.

    • i.e. char letter;
    • after we declare a char variable we can assign a character to the letter variable.

    i.e. letter = 'g';

    you can not assign a string to the char variable.

    • character literals are in single quotation marks,
    • string literals are enclosed in double quotation marks.
  16. #define
    we can use this to define prepocessor macros
  17. character array
    a character array is the way that a string is stored in to memory. Each character is stored in to a byte of memory

    i.e.

    char foo [20];

    when char is declared it can store up to 20 characters with one being the null terminator.

    i.e.

    no if we store a string in to foo like

    foo = Hello;

    it is stored in memory as

    |'H'|'e'|'l'|'l'|'o'|
  18. double
    a double is a type of variable that can store more than float and an integer. it allows for the use of decimals.

    • 8bytes
    • +/- 1.7e +/- 308 (~15 digits)

    i.e.

    • double number;
    • number = 5.435;
  19. endl
    endl declares the end of a line of a code. it stands for endline.

    it returns the cursor toe line underneath it just like n

    when using endl you have to use ; after it
  20. iostream
    is a headerfile/library. it is the input output stream library . it contains information that will allow C++ to read input from the keyboard and display output to the screen

    i.e.

    #include <iostream>
  21. e-notation
    is exponenantional /scientific notation

    i.e.

    1e-6 equals 1 x 10^-6

    or .0000001
  22. left
    when using setwidth you can align the cursor to the left or the right of the screen.

    i.e.

    cout << left << setw(8) << 1000 << 500;

    •  1,000
    •     500
  23. escape sequence
    in strings you can use a and then a character to create special sequences/behaviors

    i.e.

    • t - tab
    • " - quotationa mark
    • \ - backslash
    • n - newline
    • r - return
    • b - backspace
    • a - alarm
  24. literal
    a literal can be both number like 345 or strings like "You kicked my dog"

    They are literally what is displayed to the screen.

    literals can also be stored in to variable, which can then be stored in to the screen.
  25. fixed
    fixed is used with setprecision to display the proper amount of decimals after the '.' for example. also when using set precision the results may be scientific notation when what we want is a decimal. the fixed will ensure that decimal places is shown.

    i.e.

    #include <iomanip>

    • float number = 1.24556
    • setprecision(2) << fixed << number;

    you have to include iomanip and the variable declared must be float/double

    OUPUT

    1.24
  26. long
    long is used to expand the range of different number variables like double, int, and floats.

    by declaring long before you expand the data range of that
  27. float
    is a type of variable that stores numbers, it's range is less than a double and more than an integer

    i.e.

    • float number;
    • number = 2.444;
  28. main()
    the int main() function marks the beginning of the C++ program. main() is the main function that is a collection of functions that compose the entire program. the word int stands for integer and indicates that the function returns an integer value.
  29. floating point arithmetic
    a number displayed in e-notation formation like

    1.1 x 10^6 is equal to 1,100,000

    the conversion from e-notation to the display of the whole number is floating point arithmetic
  30. modulus operator
    the modulus operator output the remainder of two numbers

    i.e.

    a % b will put the remainder of the division of a/b

    i.e.

    2%11 = 1
  31. #include
    a preprocessor directive that allows for the input of C++ libraries
  32. multiple assignment
    allows to assign mutliple variables in one line of code

    i.e.

    a=b=c=d=12;
  33. int
    integer which declares an integer variable, this only uses whole numbers and does not include real numbers

    i.e.

    • int number;
    • number = 1;
  34. null terminator

Card Set Information

Author:
cholme14
ID:
316036
Filename:
CS110A - Test 1
Updated:
2016-02-18 01:09:20
Tags:
holmes
Folders:

Description:
holmes
Show Answers:

Home > Flashcards > Print Preview