A
A
Anton Savchenko2015-11-01 16:59:47
Programming
Anton Savchenko, 2015-11-01 16:59:47

How to completely clear the standard input stream in VS 2015?

Can't clear input stream. In the 2013 version, the cin.sync() function worked for me. In the 2015 version, I can't understand how the standard input stream works at all.

cin >> a;
cin >> b;

If аboth bare strings, then with input data, for example, "уквкп пвапк", the аstring must appear "уквкп"in , and in b- "пвапк". In the line а, everything is as it should be, but in the line there bis only the end-of-line character. Explain someone.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2015-11-05
@mastan

In the 2015 version, I can't understand how the standard input stream works at all.

Decided to check:
#include <iostream>
#include <string>

int main()
{
  std::string a, b;
  std::cin >> a;
  std::cin >> b;
  std::cout << "a=" << a << " b=" << b << std::endl;
}

This code on VS Community 2015, when you type uwcp pwapk, it outputs a=uwcp b=pwapk . Everything is fine.
Requires a complete example with non-working code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question