# Untitled

unknown
plain_text
a year ago
2.5 kB
0
Indexable
Never
```#include <iostream>
#include <string>
using namespace std;

// Задача 1
int counter(int n)
{
int cou = 0;
if (n == 0) cou++;
while (n > 0)
{
n /= 10;
cou++;
}
return cou;
}

// Задача 2
int perev(int n)
{
int perevN = 0;
int num;
int qua = 1;
int quaNum = counter(n);
for (int i = 0; i < quaNum; i++)
{
num = n % 10;
n /= 10;
for (int j = i + 1; j < quaNum; j++) qua *= 10;
perevN += num * qua;
qua = 1;
}
return perevN;
}

// Задача 3
int min(int a, int b, int c, int d)
{
int minNum = 0;
if (a <= b && a <= c && a <= d) minNum = a;
else if (b <= a && b <= c && b <= d) minNum = b;
else if (c <= a && c <= b && c <= d) minNum = c;
else if (d <= a && d <= c && d <= b) minNum = d;
return minNum;
}

int max(int a, int b, int c, int d)
{
int maxNum = 0;
if (a >= b && a >= c && a >= d) maxNum = a;
else if (b >= a && b >= c && b >= d) maxNum = b;
else if (c >= a && c >= b && c >= d) maxNum = c;
else if (d >= a && d >= c && d >= b) maxNum = d;
return maxNum;
}

// Задача 4
int pow(int n, int stepen)
{
for (int i = 1; i < stepen; i++)
{
n *= n;
}
return n;
}

// Задача 5
int vote(int v1, int v2, int v3)
{
int votes[3] = { v1, v2, v3 };
int cou0 = 0, cou1 = 0;
for (int i = 0; i < 3; i++)
{
}
if (cou0 > cou1) return 0;
else return 1;
}

// Задача 6
int invert(int n)
{
int counter = 0;
int tmp = n;
while (tmp > 0)
{
tmp >>= 1;
counter++;
}
for (int i = 0; i < counter; i++)
{
if ((n & maska) > 0)
{
}
else
{
}
}
return n;
}

int main()
{
int n;
cin >> n;
//int a, b, c, d;
//cin >> a >> b >> c >> d;
//int stepen;
//cin >> stepen;

//cout << counter(n) << endl;
//cout << perev(n) << endl;
//cout << min(a, b, c, d) << endl;
//cout << max(a, b, c, d) << endl;
//cout << pow(n, stepen) << endl;
//int v1, v2, v3;
//cin >> v1 >> v2 >> v3;
//cout << vote(v1, v2, v3);
cout << invert(n);
}
```