Course List: http://www.c-jump.com/bcc/

cis155_Ch3_lecture


  1. Week 2. Ch.3, Objects, Types, and Values
  2. "Something in memory"
  3. Introduction
  4. Introduction, declared variables
  5. Every name has a type
  6. Source files and header files
  7. Input and type
  8. Type determines operations
  9. String input
  10. Integers
  11. Strings and numbers
  12. Variable names
  13. Variable names
  14. Meaningful names
  15. Arithmetic operators
  16. Example of computation
  17. C++ fundamental types
  18. User-defined types
  19. C++ variables
  20. Declaration initializers
  21. More variable examples
  22. Objects
  23. Declaration is a statement
  24. Type safety and ideals
  25. Type safety and reality
  26. Assignment and increment
  27. About Efficiency
  28. A type-safety violation: implicit narrowing
  29. A type-safety violation: uninitialized variables
  30. Credits

1. Week 2. Ch.3, Objects, Types, and Values



2. "Something in memory"



3. Introduction



4. Introduction, declared variables



5. Every name has a type



6. Source files and header files



7. Input and type



8. Type determines operations



9. String input



10. Integers



11. Strings and numbers

  • Strings

    
     cin >> str;  // reads a word
     cout << str; // writes
     +  // concatenates
     += // appends at end
     ++ // is an error!
     -  // is an error
    
    
  • Numbers

    
     cin >> num; // reads a number
     cout << num; // writes
     +    // adds
     += n // increments by the int n
     ++   // increments by 1
     -    // subtracts
    
    

12. Variable names



13. Variable names



14. Meaningful names



15. Arithmetic operators



16. Example of computation



17. C++ fundamental types



18. User-defined types



19. C++ variables



20. Declaration initializers



21. More variable examples



22. Objects



23. Declaration is a statement

  • Variable is initialized when the thread of control gets to the initializer

  • Avoid uninitialized variables

  • Avoid global variables

  • 
    int main() 
    {
        int count = 0;
        count = count + 1; 
        return 0;
    } 
    
    

24. Type safety and ideals



25. Type safety and reality



26. Assignment and increment



27. About Efficiency



28. A type-safety violation: implicit narrowing



29. A type-safety violation: uninitialized variables



30. Credits