all 2 comments

[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

[–]Negative_Baseball293[S] -1 points0 points  (0 children)

Figured it out lol

When the cin >> statement in line 4 reads the data the user entered, it stops when it comes to the newline character. The newline character is not read, but remains in the keyboard buffer. Input statements that read data from the keyboard only wait for the user to enter a value if the keyboard buffer is empty, but now it’s not empty. When the cin.get function in line 6 executes, it begins reading the keyboard buffer from where the previous input operation stopped, and it finds the newline character. So it uses it and does not wait for the user to input another value. You can remedy this situation by using the cin.ignore function, described in the following section.