I am a begginner in C++ and in programming generally. I am reading http://www.cprogramming.com/tutorial/lesson1.html this tutorial and I have one question.
I could not understand the purpose of the cin.ignore() function. I recompile the module without the cin.ignore() function and the result was the same.
using namespace std;
cout<<"Please enter a number: ";
cout<<"You entered: "<< thisisanumber <<"\n";
While running the program, I typed a character instead of a number and the result was the number 2. eg. I typed "s" and the output was "2". I typed 43243432767436482 and the output was 2 again. So what the cin.ignore() really does ?