tolord

Untitled

Jan 21st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include "conio.h"
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     char c;
  10.     int k, y;
  11.     double d = 0;
  12.     bool OK = false;
  13.     int n = 0;
  14.     cin >> n;
  15.  
  16.     c = char(0);
  17.     while (c != char(13))
  18.     {
  19.         OK = false;
  20.         c = getch();
  21.         cout << c;
  22.         if ((c >= '0') && (c <= '9'))
  23.         {
  24.             y = int (c) - int ('0');
  25.             OK = true;
  26.         }
  27.         else
  28.             if ((c >= 'a') && (c <= 'z'))
  29.             {
  30.                 OK = true;
  31.                 y = (int)c - 87;
  32.             }
  33.         if (OK) d = d * n + y;
  34.     }
  35.     cout << endl;
  36.     cout << d;
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment