| | |
Array of strings
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 89
Reputation:
Solved Threads: 2
well, i am quite confused here. You mean to say you want to take input of several strings in a single character array? 
infact, here you are asking for a single character everytime :
> cin >> a[i]
if you meant to count the number of characters, then you may do it using some function like strlen(), or you may put a counter along with input.
Also, the array here is certainly unstable, without '\0' null character.

infact, here you are asking for a single character everytime :
> cin >> a[i]
if you meant to count the number of characters, then you may do it using some function like strlen(), or you may put a counter along with input.
Also, the array here is certainly unstable, without '\0' null character.
Bhoot
•
•
Join Date: Mar 2008
Posts: 89
Reputation:
Solved Threads: 2
If you want only a single string, then its getline().
If you want several strings, then a single array certainly wont do. I wonder how will you differentiate between strings. As you said, if you use '.', still wouldnt it be better if you use a 2-D array of characters, or an array of character pointers?
If you want several strings, then a single array certainly wont do. I wonder how will you differentiate between strings. As you said, if you use '.', still wouldnt it be better if you use a 2-D array of characters, or an array of character pointers?
Bhoot
![]() |
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: multiplying values that are stored in the array
- Next Thread: Linked List Question
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib 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 tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





