so im trying to use the getline function on c++ withe codeblocks app
but anytime i use the function which has the format getline(iostream,variable); it keeps ignoring the first letter or word before the space
for eg in this sample
cout<< "enter your full name"<<endl;
//user : samuel forson
cin>> fname;
cout << fname; <<endl;
//it will ignore the samuel and print out forson

any help please

check this,hope it helps

#include <iostream>

using namespace std;

int main()
{
    string str; 

    cout << "Please enter your name: \n"; 
    getline(cin, str); 
    cout << "Hello, " << str 
         << " that's how getline works!\n"; 

    return 0; 
}