Skip to content
Sign in
Computer

If the variable name is ‘age’ and the programmer wants to input age, which is the correct syntax?

Tap an option to check the answer. You can also press A–D.

Show answer

Correct answer: C) cin>>age;

cin >> age; is the correct syntax in C++ to take input from the user and store it in the variable age. The >> operator is used with cin to extract the input value into the variable.
Explanation
cin >> age; is the correct syntax in C++ to take input from the user and store it in the variable age. The >> operator is used with cin to extract the input value into the variable.