| | |
array of strings
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
This is no such concept as multi-line strings. If you want CR/LF in the string then just append "\n" whereever you want a new line to begin when output
C++ Syntax (Toggle Plain Text)
std::string hello = "Hello\nWorld\n"; cout << hello;
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Apr 2008
Posts: 19
Reputation:
Solved Threads: 1
by multi-line i mean this concept
getline(cin, quiz, '$');
This will allow the user to enter strings composed of multiple lines. He can continue to enter strings (even if he presses enter) until he presses $.
now i want to make an array which can store this type of strings. Is it again not possible??
getline(cin, quiz, '$');
This will allow the user to enter strings composed of multiple lines. He can continue to enter strings (even if he presses enter) until he presses $.
now i want to make an array which can store this type of strings. Is it again not possible??
you mean something like this?
I hope you realize you can't enter "$1,000.00" with that
C++ Syntax (Toggle Plain Text)
std::vector<std::string> arr; std::string line; while( getline(cin,line) && line[0] != '$') { arr.push_back(line); }
I hope you realize you can't enter "$1,000.00" with that
Last edited by Ancient Dragon; Apr 1st, 2008 at 11:01 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Sorting a 2D Array of Strings (C++)
- how to read an array of strings in C++ (C++)
- 2d array of strings (C++)
- Declaring an array of strings in C++ (C++)
- Initializing an array of strings and printing it. (C++)
- Is there a way to tokenize an array of strings (C++)
- filling an array with strings using gets() (C)
Other Threads in the C++ Forum
- Previous Thread: inheritance help
- Next Thread: how to read many text file?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






