Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char input[3] = {0,0,0};
- char litera;
- int main() {
- cin >> input;
- input[0] -= '0'; //robimy z tego wartość
- input[1] = (input[1] <= '9') ? input[1] - '0' : input[1] - 'A' + 10;
- /* równoważne "prościej" poniżej
- if (input[1] <= '9')
- {
- input[1] -= '0';
- }
- else
- {
- input[1] = input[1] - 'A' + 10;
- }*/
- litera = input[0] * 16 + input[1];
- cout << (int)litera << endl << litera;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement