cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Writing arrays with numbers and strings
Writing arrays with numbers and strings
Mar 17, 2011 at 12:45pm UTC
theholyfork
(36)
Is there any way to write an array that can take both numbers and strings in?
Ex.
1
2
3
4
int
person[1][2]; person[1][0] =
"Bob"
; person[1][1] = 27;
Is there any way to do that?
Thanks
Last edited on
Mar 17, 2011 at 12:45pm UTC
Mar 17, 2011 at 12:50pm UTC
Computergeek01
(5613)
A "Structure" or "Class" would be better suited for this type of thing. This is because I assume you're trying to associate two integer properties with each person variable.
Mar 17, 2011 at 7:58pm UTC
theholyfork
(36)
Ah! Thank you so much! Everything works much better now.
Topic archived. No new replies allowed.