- 1
How to get a number from a string input
I don't know if this is entirely possible, but if it is, how would I make it so that a certain string input gives a variable (int, float, etc) a specific number value. for example, if you were to put a certain word or letters in the input, say like "abc" for the value of the string variable, and then a different variable that was a float or integer was given a number value for the rest of the code. mind you, this variable would be added and multiplied and whatnot with other number variables
6 Antworten
+ 4
Where is your code?
You don't have any public made in your profile ^^
Anyway, your description isn't clear: are you trying to convert a string value to an integer or floating point one?
And what's the language you're interrested for the answer?
+ 3
So, edit your question to at least ad 'c++' tag if you don't want to get answer in plenty of language ;P
+ 3
treat your string as an array of characters. So now, using an array, how will you display your number??
+ 1
Alright I'll get the code, and I'm pretty much trying to convert a string to a number value and it's c++
0
I've tried experimenting but the code always alters the number or something because I don't get the right result, but I do get a result
0
soooo, I must've done something wrong last time because I re entered the code and it's all good now. thank you anyways, and I'll make sure I post the code if anything else goes wrong