Skip to content

Instantly share code, notes, and snippets.

@zhrkvl
Created July 4, 2015 21:56
Show Gist options
  • Select an option

  • Save zhrkvl/1030190b223a42dc0cc0 to your computer and use it in GitHub Desktop.

Select an option

Save zhrkvl/1030190b223a42dc0cc0 to your computer and use it in GitHub Desktop.
приколюха
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <cstring>
#include <map>
#include <iomanip>
#include <queue>
using namespace std;
#define mkp(a, b) make_pair(a, b)
#define F first
#define S second
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define maxl numeric_limits<int>::max()
#define maxll numeric_limits<long long>::max()
#pragma pack(push, 1)
struct bts
{
unsigned b8: 1;
unsigned b7: 1;
unsigned b6: 1;
unsigned b5: 1;
unsigned b4: 1;
unsigned b3: 1;
unsigned b2: 1;
unsigned b1: 1;
};
#pragma pack(pop)
union cl
{
int a;
bts bt[4];
} cic;
int main()
{
cic.a = 1 << 23;
for(int i = 3; i >= 0; i--)
printf("%d%d%d%d%d%d%d%d", cic.bt[i].b1, cic.bt[i].b2, cic.bt[i].b3,
cic.bt[i].b4, cic.bt[i].b5, cic.bt[i].b6,
cic.bt[i].b7, cic.bt[i].b8);
// cout << sizeof(bts) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment