Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

fragment code question

$
0
0
this fragment was on a past exam;

Consider the following code fragment:
int x=2, y=4; char ch;
cin >> x; cin.get(ch); cin >> y;
cout << x * y;
7)
If the user types the following at standard input, what does the above code fragment print? Note: <Enter> means they pressed the “Enter” key
2 * 2 <Enter>

A)4
B)5 C)6 D)8 E)10

The answer is 10 but i don't understand how

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>