Week 4

Input/Output & Formatting

Learning Objectives

    Read data from the console input (cin).

    Write data to the console output (cout).

    Format outputted data using member functions:

      width()
      precision()
      setf() (ios::fixed, ios::scientific, ios::showpoint, ios::right, ios::left)
      unsetf()

    Format outputted data using manipulators:

      setw()
      setprecision()
      setioflages() (ios::fixed, ios::scientific, ios::showpoint, ios::right, ios::left)
      resetioflags()

At the end of the week you should be able to:

    Read in a value from the console and place it in a variable.

    Display the contents of a variable to the console.

    Display a floating point number to a specified precison.

    Display a value in a field of a specific width

    Display a floating point number in fixed or scientific notation.

Reading Assignment

Section 2.4, Pages 73 - 82 (if/else)

Section 7.1 - 7.2, Pages 382-413 (Boolean Expressions, Miltiway Branches)

Take-Home Assignment

[Home] [About Me] [Office Hours] [CIS 121] [CIS 123] [CIS 127] [CIS 226] [CIS 227]