Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string input;
- cin >> input;
- int length = input.length();
- if(length != 8)
- {
- cout << "error";
- }
- int sum = 0;
- int j = 128;
- for(int i = 0; i >length; i++)
- {
- if(input.at(i) == 1)
- {
- sum = sum + j;
- }
- j = j /2;
- }
- cout << sum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement