Taking User Input
We have already studied the use of cout object along with insertion operator. It is used to print string/text (sequence of characters like "My age is 20.") as well as variables on screen.
For taking input from user, we use cin object along with extraction operator.
cin is pronounced as "see-in"
Point: When we take input from the user, we have to store it in a variable.
- We use insertion operator after cout.
- cout is used for printing.
- We use extraction operator after cin.
- cin is used to take user input.
Building a simple Calculator
Congratulations you have built your first mini project.
Practice Exercises
Complete these exercises to reinforce your learning and earn XP
Sign in to track your progress and earn XP!
Exercise 1 of 2Easy
Which of the following is a best practice in programming?
10 XP~2 min
Exercise 2 of 2Easy
Code that is easy to read and understand is called ___ code.
10 XP~2 min