UNIVERSITY OF  DELAWARE

CONTINUING EDUCATION

C++ Programming 

Program Examples for cin instrution.

 

Example 1 - Shows string input with multiple variables

Example 2 -  Shows string input with one variable. Output incorrect because of logic

Example 3 - Corrects b previous example by using getline

Example 4 - Mixed numeric and string input - does not process the string

Example 5 - Corrects above processing using get()

Example 6 - Corrects exercise 4 using get(ch)

Example 7 - Shows what happens when non numeric data entered for a numeric variable

Example 8 - Corrects errors from example 7. Demonstrates purging the input stream and clearing the error code