Assign numbers to characters C++ -


i need way assign numbers letters in c++, example, '$' represent number 1. need able obtain number character function, e.g. getnumfromchar('$') return 1 , getnumfromchar('#') return 2. there easy , fast way in c++?

create vector std::vector<int> v(256,0); indexed characters , of numbers zeros treat invalid numbers. assign each 'numbered' character number e.g. v['$'] = 1; v['#'] = 2; using fact characters integers 0 255.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -