| | |
how to read an array of strings in C++
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2007
Posts: 59
Reputation:
Solved Threads: 0
hi all! i m trying to input an array of strings same as we input array of integers. by declaring a 2 dimensianal array runnig 2 for loops like
plz help me i m in great confusion because by doing in this way, i m not getting the actual no of strings
C++ Syntax (Toggle Plain Text)
for(i=0;i<m;i++) for(j=0;j<n;j++) cin>>arr[i,j]
No need to that a way.
Here's how you could do that:
Here's how you could do that:
C++ Syntax (Toggle Plain Text)
char str[5][50]; for(int i=0; i<5; i++) { cin >> str[i]; }
![]() |
Similar Threads
- Declaring an array of strings in C++ (C++)
- Initializing an array of strings and printing it. (C++)
- Read from an array (Java)
- 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: How do I
- Next Thread: Please help me out, I realy need help in the next 4 hours
Views: 3227 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






