An example using a std::map
as suggested in the comments could look like this:
#include <iostream>
#include <map>
int main() {
// a map from char (key) to int (value)
std::map<char, int> ascii_map;
// put the normal ASCII values in the map
for(int ch = 0; ch <= 127; ++ch)
ascii_map[static_cast<char>(ch)] = ch;
// make your adjustments
ascii_map['P'] = 888;
// show the current map:
for(auto [ch, val] : ascii_map) {
std::cout << (ch >= ' ' ? ch : ' ') << '\t' << val << '\n';
}
// get values from chars
std::cout << ascii_map['O'] << '\n'; // prints 79
std::cout << ascii_map['P'] << '\n'; // prints 888
}
solved How to change ASCII table data? [closed]