// you’re reading...

Introduction to C++

cin

C++ is equipped with another operator used to request values from the user

  • The user usually provides such a value by typing it using the keyboard



The cin operator is used for that purpose

  • (Pronounce “see in”)
  • It displays a blinking cursor on the monitor to let the user know that a value is expected
  • Uses two greater than signs “>>” followed by the name of the expected value (A-1)



Example of (A-1)

    cin >> valueName;



If you are requesting many values from the user

  • You can write a statement that would act accordingly by separating values with as many >> operators as necessary (A-2)



Example of (A-2)

    cin >> firstName >> lastName >> age;

Discussion

No comments for “cin”

Post a comment