Lecture overview -- Keyboard shortcut: 'u'  Previous page: Input and output in C++ -- Keyboard shortcut: 'p'  Next page: Standard streams -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 32 : 42
Notes about C++
Basic facilities
Overloaded operators and IO

Existing operators must be choosen for IO purposes

  • The assignment operator was considered

    • cin = x   and   cout = y

    • Its association to the right is inappropriate

  • The less than and greater than operators were considered

    • cin > x   and   cout < y

    • Unreadable, and confusing

  • The left shift and right shift operators were choosen

    • cin >> x   and   cout << y

    • The relative low priority of << is practical when values of expressions must be printed.

    • cout << x + y * z   and not   cout << (x + y * z)

  • The C++ Programming Language: Page 121-122: operator priorities