getline help
Nov 28, 2011 at 4:39am UTC
How do you use
1 2
getline(cin, input);
cin.ignore();
without the double space.
also as a side note how do you prototype a function?
Nov 28, 2011 at 5:18am UTC
What double space?
Side Note:
1 2 3 4 5 6 7 8 9 10 11
int my_function(char c); // prototype
int main()
{
int i = my_function('A' );
}
int my_function(char c) // definition
{
return int (c);
}
A prototype is simply the function description without the function body.
Nov 28, 2011 at 5:27am UTC
ok to prototype and i have had a linux os with gterminal and a mac w/ xcode and when ever i use above code it makes me hit enter twice instead of once on the program
Nov 28, 2011 at 6:09am UTC
Then remove the line cin.ignore();
.
Topic archived. No new replies allowed.