Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 08 / task1.cpp
blob: b8c5943732c65618b74d0c0537755c29bfa4413f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

const int SIZE = 32;

int convert(bool arr[SIZE])
{
	int result = 0;
	for (int i = 31; i >= 0; i--)
		result += arr[i] * (1 << 31-i);
	return result;
}
int main()
{
	bool arr[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1 };
	cout << convert(arr);
}