I tried getline(cin, .... ), but this cannot take input more than one line. The end of input is determined by something like #.
+3
A:
You can use getline with a different character than '\n' as the delimeter.
// will collect input until the user enters a #
getline(cin,mystring,'#');
PigBen
2010-10-23 23:38:29
A:
I'd go for conio.h
(or whatever else your platform has if it doesn't have conio) and just write an input method myself. That way you can make it much prettier and foolproof.
Vilx-
2010-10-23 23:47:18
+1
A:
Try something like:
#include <iostream>
...
std::string input;
while(1)
{
input = "";
std::cin >> input;
if(input[input.size() - 1] == '#')
break;
}
Use C++ stuff, not C stuff.
muntoo
2010-10-23 23:53:28