The function int(c) returns the integer value associated with a character variable c.
#include <iostream>
using namespace std;
int main()
{
for (char i = 'A'; i <= 'Z'; i++){
cout << i << " : " << int(i) << endl;
}
for (char i = 'a'; i <= 'z'; i++){
cout << i << " : " << int(i) << endl;
}
return 0;
}
No comments:
Post a Comment