This is my first time when it comes to casting and enums, so yea I came across this problem while trying to cast.
Assume I have the following enum
void loadData(castle &al3a, queue &q, float &c1, float &c2, float &c3)
int i = 0;
int n = 0;
cout << "Error" << endl;
myfile >> T_Health >> T_Attack_N_Enemies >> T_Fire_Power;
myfile >> c1 >> c2 >> c3;
for (int i = 0; i < n - 3; i++)
myfile >> a >> b >> c >> d >> e >> f >> g;
x.ID = a;
x.type = static_cast<Type>(b);
x.time_step = c;
x.Health = d;
x.fire_power = e;
x.reload_power = f;
x.region = static_cast<Region>(g);
for (int i = 0; i < 4; i++)
al3a.towers[i].Health = T_Health;
al3a.towers[i].attackEnemies = T_Attack_N_Enemies;
al3a.towers[i].firePower = T_Fire_Power;
al3a.towers[i].Tregion = (Region)i;
// shielded enemies have higher priority than ordinary enemies
/*Priority(Shielded Enemy) = C1 * (EnemyFirePower / EnemyDistance) + C2 / (EnemeyRemaining time to shoot + 1) + EnemyHealth * C3*/
If your char variable contains 'a', it does contain an ascii value (97). You should not be casting such value to enum unless you know what you are doing. Enums in C++ are usually stored on 8 bits (which is the same size as size of char) (I am not sure if this is standardized) so your x.region contains same value (ASCII) as your char g (that is why std::cout prints the ASCII value).
Doing enum cast is usually done only if your integral type is in enum's range (so if enum contains 4 elements, you should cast only integral values of range 0-3).
If you are interested in enum type behavior, you should look at this answer.