mercredi 8 septembre 2021

How to differentiate between ascii value and a number?

I am asking if there is any way in C++ to differentiate between an ASCII value and a number, for example 'A' and 65 both have value of 65, but how to differentiate between them?

Assume we want to sum up two numbers, so sum(10,65) should return 75, but sum(10,'A') should return 0. Also, keep in mind that the arguments of sum() should have the same type, which is double.

Aucun commentaire:

Enregistrer un commentaire