#getline function
7 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
here is the code
why have you decided to use
cin>>s;
cin.ignore();
?
reading input from the console and storing it in s
ignoring leftover input in the buffer (in this situation I assume it is interpreting your first word as said input)
if you do have 10 characters of leftover input from something then that may make sense but just for taking input with nothing else to interfere
#include<iostream>
using namespace std;
int main() {
char s[40];
cin.getline(s, 40, '?');
cout << s;
return 0;
}
should be fine
!solved