I was wondering whether it was possible to use dynamic memory or something else to achieve something to the effect of entering numbers or a string using standard input without first having to specify how many instances you intend to enter. If this can be done through some other method please point me to a good resource to learn about it or post some code snippets. Thanks,
AspiringCoder
AspiringCoder
-2
Newbie Poster
Recommended Answers
Jump to PostThe string class and all of the STL container classes grow dynamically. What are you trying to do that those classes cannot accomplish.
Jump to PostThere are lots of ways to do it -- which one you use will depend on the data you want. std::string is a c++ class that manages chracter arrays and expands/contracts it on demand. vector, list, set, and map manage arrays or lists of objects, and also expand/contract on demand. …
All 5 Replies
Radical Edward
301
Posting Pro
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
AspiringCoder
-2
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.