SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Nedorezov Egor 108 group
  2. 24 var */
  3.  
  4. #include <iostream>
  5. #include <stdlib.h>
  6. #include <math.h>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.         char a[1], b[1];
  13.  
  14.         cout<<"enter a"<<endl<<flush;
  15.         for (int i = 0; i < 2; i++)
  16.                 cin>>a[i];
  17.  
  18.         cout<<"enter b"<<endl<<flush;
  19.         for (int j = 0; j < 2; j++)
  20.                 cin>>b[j];
  21.  
  22.         int a1[1], b1[1];
  23.         char check[] = "0123456789ABCDEF";
  24.  
  25.         for (int numa = 0; numa <= 1; numa++)
  26.         {
  27.             for (int k = 0; k <= 15; k++)
  28.                 if (a[numa] == check[k]) a1[numa] = k;
  29.         }
  30.  
  31.         for (int numb = 0; numb <= 1; numb++)
  32.         {
  33.             for (int l = 0; l <= 15; l++)
  34.                 if (a[numb] == check[l]) b1[numb] = l;
  35.         }
  36.  
  37.         int a10 = a1[0] * 16 + a1[1];
  38.         int b10 = b1[0] * 16 + b1[1];
  39.  
  40.         int res10 = a10 + b10; int cnt;
  41.  
  42.         if ( ((res10 / 16) / 16) == 0 ) cnt = 1; else cnt = 2;
  43.  
  44.         char res16[2], ans[2];
  45.  
  46.         res16[0] = res10 % 16;
  47.         res16[1] = (res10 / 16) % 16;
  48.         res16[2] = (res10 / 16) / 16;
  49.  
  50.         for ( int m = 0; m <= 2; m++)
  51.         {
  52.             for (int n = 0; n <= 15; n++)
  53.                 if (res16[m] == check[n]) ans[m] = check[n];
  54.         }
  55.     for (int o = 0; o <= cnt; o++)
  56.         cin>>ans[o];
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top