How can I get a numerical value from a string? I am using the command "getline" to store a string. I want the user to be able to enter "assign 8 strength", right now they have to type "assign strength" over and over until they run out of points. Is it possible to do this?
cclausen7
0
Newbie Poster
Recommended Answers
Jump to PostYes, but you need to make sure to standardize your input format and institute some good error checking otherwise your user could really wreak some havoc with the application.
How are you currently recognizing the "assign strength" command? If you're just using simple string comparison, you'll have to make …
Jump to PostNot exactly what i meant. The way you read input is somewhat situation-dependent but you should be as consistent as possible.
What I meant was make sure the user understands that the required input format for a command is verb value object and that you reject any other format …
All 8 Replies
Fbody
682
Posting Maven
Featured Poster
cclausen7
0
Newbie Poster
Fbody
682
Posting Maven
Featured Poster
cclausen7
0
Newbie Poster
mrnutty
761
Senior Poster
Fbody
682
Posting Maven
Featured Poster
mrnutty
761
Senior Poster
Fbody
682
Posting Maven
Featured 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.