#include <bitset>
#include <iostream>
int main() {
const int mask = 0xFFFFFFFF;
int a = 12345678;
std::cout << std::bitset<32>(a) << std::endl;
int p = 9;
std::cout << std::bitset<32>(a & (mask << 9 - 1)) << std::endl;
return 0;
}
// 00000000101111000110000101001110
// 00000000101111000110000100000000
void bubble_sort(int array[SIZE])
{
int transfer = 0;
int comparison = 0;
cout << "\nпузырьковая сортировка" << endl;
for (int i = 0; i < SIZE-1 ; i++)
{
for (int j = SIZE-2; j >= i; j--)
{
comparison++;
if (array[j] > array[j+1])
{
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
transfer++;
}
}
}
cout << "СРАВНЕНИЕ " << comparison << endl;
cout << "ПЕРЕСЫЛКА " << transfer << endl;
}
соответственно разный синтаксис и проч.
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;
#include <iostream>
using namespace std;
int main()
{
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;
int factor;
factor = 212 - 32;
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;
cout << "Fahrenheit value is:";
cout << fahrenheit << endl;
return 0;
}