I am a beginner... I just wrote the following code...
[code]
#include <stdio.h>
#include <iostream.h>
#include <string>
main()
{
using namespace std;
string name;
//name = "Test";
cout << "Enter your name: ";
cin >> name;
cout<< "Hello " << name;
getchar();
getchar();
getchar();
}
[code\]
now, when i type in "m a"
it says
Hello m
and the getchars work.
when i type "mh a"
it says
Hello mh
and the getchars work
but when i type "m ah"
it says
Hello m
and the getchars wont work..
the program ends.
why is this happening ?