Problem Solving and Pregramming-Fll 20-Sectine Exm 1 page Sof 22. [6pts] Given t
ID: 3594371 • Letter: P
Question
Problem Solving and Pregramming-Fll 20-Sectine Exm 1 page Sof 22. [6pts] Given the following input buffer and buffer pointer tartin ot after each read operation, show whar value will be sorad,and where the buffer pointer will be pointing after the read Assume that the read operations (a-f) are performed in sequence. This means that the buf ler pointer for any read operation starts where the previous read eperation left it. In the input buffer R represents the ENTER character T represents the TAB character For the value stored, if necessary, use B to represent the BLANK character N to represent nothing/inul R to represent the ENTER character T to represent the TAB character 1 2 34 5 678 9 10 11 12 13 1 15 16 17 18 19 20 a b c Start a) cin b) cin e) getline d) getline e) cin 0 getlineExplanation / Answer
cin stops at first whileLine character which it gets.
cin ignores anywhiteline character at the start when it starts reading userinput.
getline reads the line till the new line character, including it.. It keeps the spaces at the start
a)
cin:
Value stored after read: a
Buffer pointer number after read: 3
b)
cin:
Value stored after read: bc
Buffer pointer number after read: 6
c)
getline:
Value stored after read: TR
Buffer pointer number after read: 8
d)
getline:
Value stored after read: BTBR
Buffer pointer number after read: 12
e)
cin:
Value stored after read: def
Buffer pointer number after read: 16
f)
getline:
Value stored after read: ghTBR
Buffer pointer number after read: 21
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.