0
In c++ how would I create a code where If I press 'A' in the input, it then output '1' and for 'B' 2 and so on
2 Réponses
0
You can literally hardcoded it using switch() statement,
Or Just dirrectly convert character into integer minus 64 (A is 65 in Acii) like:
int main() {
char c;
cin >> c;
int num = c;
cout << num - 64;
return 0;
}
0
Thx 🌱