Imput Buffer after Operations Question

Hello, I'm not asking necessarily for the answers, i'm just looking to be pointed in the right direction because I'm having a little bit of a hard time understanding this.

Given the following input buffer and buffer pointer starting point (1), after each read operation, show what value will be stored, and where the buffer pointer will be pointing after the read. 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 represents nothing/null
R represents the ENTER character
T represents the TAB character
______________________________________________________
1, 2 , 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 42 |
a, R , R, b, T, c,__, T, R,___, R , d ,___, T ,, e ,, f ,, R ,, T ,, __, R |
_____________________________________________________|

(The underscores are blank spaces, don't mind the second commas, they were used to keep alignment)

Read operation;; Value stored after read;; Buffer pointer after read

a) cin __________ __________

b) getline __________ __________

c) cin __________ __________

d) getline __________ __________

e) getline __________ __________
Last edited on
bump
Take a look here:

http://www.cplusplus.com/reference/string/string/getline/?kw=getline

It has an example which can be the starting point to modify in order to get your answers.
Formatted input (std::cin >> input):
skips leading white space, extracts valid characters into the input, leaves trailing white space in the buffer

Unformatted input (std::getline( std::cin, input ) with new line as the delimiter):
does not skip leading white space, extracts characters up to (but not including) the delimiter (new line) and stores them into the input, and then extracts and throws away the delimiter (new line).

Spoiler: http://coliru.stacked-crooked.com/a/9c02ee65253b8222
Topic archived. No new replies allowed.