Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Nedorezov Egor 108 group
- 24 var */
- #include <iostream>
- #include <stdlib.h>
- #include <math.h>
- using namespace std;
- int main()
- {
- char a[1], b[1];
- cout<<"enter a"<<endl<<flush;
- for (int i = 0; i < 2; i++)
- cin>>a[i];
- cout<<"enter b"<<endl<<flush;
- for (int j = 0; j < 2; j++)
- cin>>b[j];
- int a1[1], b1[1];
- char check[] = "0123456789ABCDEF";
- for (int numa = 0; numa <= 1; numa++)
- {
- for (int k = 0; k <= 15; k++)
- if (a[numa] == check[k]) a1[numa] = k;
- }
- for (int numb = 0; numb <= 1; numb++)
- {
- for (int l = 0; l <= 15; l++)
- if (a[numb] == check[l]) b1[numb] = l;
- }
- int a10 = a1[0] * 16 + a1[1];
- int b10 = b1[0] * 16 + b1[1];
- int res10 = a10 + b10; int cnt;
- if ( ((res10 / 16) / 16) == 0 ) cnt = 1; else cnt = 2;
- char res16[2], ans[2];
- res16[0] = res10 % 16;
- res16[1] = (res10 / 16) % 16;
- res16[2] = (res10 / 16) / 16;
- for ( int m = 0; m <= 2; m++)
- {
- for (int n = 0; n <= 15; n++)
- if (res16[m] == check[n]) ans[m] = check[n];
- }
- for (int o = 0; o <= cnt; o++)
- cin>>ans[o];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement