For example:
char X = 3;
char Y = 6;
char Z = 9;
int scoreAll, score1, score2, score3;
cin >> score1 >> score2 >> score3; // user should enter X >> Y >> Z
scoreAll = score1 + score2 + score3;
cout << scoreAll // output should be 18
is there a way in c++ to assign an int number to a char type and then perform arithmetic operations on it using another variable?
Basically i want to type a char X and and make the compiler act like i typed 3.
Additional explanation: The user enters several characters, "XYXXZ" for example, each character has it's own value, the compiler now should add the values of these characters and output the result as an integer only (result of "XYXXZ" should be = 24).