Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 08 / task1.cpp
blob: f993c7ec140d90e28f9e1ae228697fc86c6c401b (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);
}