Microsoft
Software
Hardware
Network
Question : C++ Assigne multi word input into single string fiield
To assign a string field a multi word string (with spaces) from a file you can use a delimeter.
But how do you get multi word input into a single string from the console?
For example:
Please enter a product name: Product A
I would like to assign "Product A" to a single string
But if I use cin >> productName;
I will only get the first word of Product but the A will not be included.
Any help would be appreciated. Thanks!
Answer : C++ Assigne multi word input into single string fiield
Hm, that should not happen - can you try to explicitly specify a delimiter line
getline(cin,productName,'\
n');
or
char buf[255];
cin.getline(buf,255);
productName = buf;
?
(sorry, have to be offline for a little while now)
Random Solutions
Code was working in Android 2.1 SDK but not on 2.2
compareTo() - JavaScript example needed
Running RMI on Tomcat Servlet - How do I set up RMISecurityManager?
Windows NT4 High Encryption Pack
Email sent to Tiscali email addresses bouncing with No PTR record error
Why don't Lotus Notes document links work when sent to MS Outlook emails.
Firebox X500 - Where to start....
Link to PDF files from DVD Menu
SBS 2008 strange issue
Fading in/out a popup Window in Flex 4.0