Important MCQ

If int x; and the user types 7.9, cin >> x stores

Q.If int x; and the user types 7.9, cin >> x stores

A) 7
B) 0
C) 8
D) 7.9
Correct Answer:
Option A
Detailed Explanation:
A) 7 is correct. cin is an istream object used for keyboard input with >>. It can read multiple values separated by whitespace; getline reads a complete line including spaces.