#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <windows.h>
/* c only version
int holds around 65,536 values (it is at a minimum 16 bit)
short is actually half of an integer, in that it will be at a max 16 bit
long is a 32 bit integer
char is only 8 bits
unsigned char is the clearest way to manipulated a byte
% is modulo - 2 ? for binary? & is AND operator | is OR operator
<< is left shift */
/* windows uses LOBYTE and HIBYTE */
int main(void)
{
short i,k;
int m;
char d;
unsigned char c;
d = 128;
cout << int(d) << ":" << int(d) << " " << endl;
for(i=1; i<2049; i=i*2)
{
cout<<int(i)<<":"<<int(i)<<" "<<endl;
c=HIBYTE(i);
d=LOBYTE(i);
cout<<int(c)<<":"<<int(d)<<" "<<endl;
}
cout<<"press enter to continue"<<endl;
getchar();
// i=3;
d = 7 & 3;
cout<<"char c is 7 (111) AND 3 (11): "<<(int)c<<endl;
d = d | 8;
cout<<"char c OR with 8: "<<(int)d<<endl;
cout<<"press enter to continue"<<endl;
getchar();
return 0;
}