Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string color_one, color_two;
  10.  
  11.     cin >> color_one >> color_two;
  12.  
  13.     cout << "#";
  14.  
  15.     for (int i = 0; i < 3; i++)
  16.     {
  17.         cout << setw(2) << setfill('0') << hex
  18.             << ((stoi(color_one.substr(i * 2 + 1, 2), nullptr, 16)
  19.                 + stoi(color_two.substr(i * 2 + 1, 2), nullptr, 16)) / 2);
  20.     }
  21.  
  22.     cout << endl;
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement