CS110A - Test 1

Home > Preview

The flashcards below were created by user Anonymous 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

Card Set Information

Author:
Anonymous
ID:
315964
Filename:
CS110A - Test 1
Updated:
2016-02-15 23:41:46
Tags:
compsci holmes
Folders:

Description:
CS110 CCSF college exam study guide notecards
Show Answers:

Home > Flashcards > Print Preview