derelict
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: #include <iostream> #include <stdio.h> using namespace std; union { int state; struct { unsigned P : 1; unsigned Z : 1; unsigned C : 9; unsigned E : 1; unsigned N : 4; }bitFields; }channel; int main() { unsigned int value = 0; channel.bitFields.Z = 0; cout<<"Channel number: "; cin>>value; channel.bitFields.N = value; cout<<"Is error: "; cin>>value; channel.bitFields.E = value; cout<<"Interrupt code: "; cin>>value; channel.bitFields.C = value; cout<<"Is finished: "; cin>>value; channel.bitFields.P = value; cout<<endl; printf("Channel state is %04X", channel.state); getchar(); getchar(); } | | Всего записей: 232 | Зарегистр. 11-06-2006 | Отправлено: 02:26 02-12-2009 | Исправлено: derelict, 02:26 02-12-2009 |
|