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 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 …
Jump to PostWait let me get this straight, you have a command, something like this :
"assign 8 strength
. And this should assign strength to 8. So in general is the format going to be like so :command number attribute
?
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.