mercredi 18 novembre 2020

How to get the numeric value of string in C++ (not just the numbers in the string) [closed]

I am trying to figure out how to convert a string into an integer or other numeric value in order to map it.

Basically, I have a list of words and I want to convert them into numeric values in order to store them into a vector (So converting a word like 'grapple' into an integer). I know stoi(string) gives a numeric value, but ONLY if the string is a number itself...

Additionally, I must be able to convert the number back into a word later on in the process.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire