Dec 6, 2014 at 7:44am UTC
my cin.getline doesnt let me enter the variable it takes them as null and procedess to cout and finally getch(); what should i do to correct it.
i use code blocks gcc compiler
1 2 3 4
char comp[50];
cin.getline(comp,50);
cout<<endl<<comp;
getch();
i have also tried the strings library ( used string data type ) and also tried some work arounds still it didnt work.
1 2 3 4
char comp[50]<<endl;
cin>>comp;//this piece of code takes in the string but terminates
//at white spaces
cout<<endl<<comp;
same over here...
1 2 3 4
string comp<<endl;
cin>>comp;//this piece of code takes in the string but terminates
//at white spaces
cout<<endl<<comp;
Last edited on Dec 6, 2014 at 7:45am UTC