For some reason....i'm having a bit of trouble getting input from the user and assigning that input to structure members...
The error I get is:
attempt to take.
![]()
And here is my code for the struct:
[code]
struct MyBools
{
USHORT b1 : 1;
USHORT b2 : 1;
USHORT b3 : 1;
USHORT b4 : 1;
USHORT b5 : 1;
USHORT b6 : 1;
USHORT b7 : 1;
USHORT b8 : 1;
USHORT b9 : 1;
USHORT b10 : 1;
};
[code]
For future reference, USHORT is an unsigned short, I used typedef for that.
And here is main():
Now from what I take it, I should be able to assign 1 or 0 to those members because there both 1 bit in size, but I don't get.....why it won't let that happen? Everything seems fine to me..Code:int main() { MyBools bOne; cout << "Enter in 10 1's or 0's: "; cin >> bOne.b1 >> bOne.b2 >> bOne.b3 >> bOne.b4 >> bOne.b5 >> bOne.b6 >> bOne.b7 >> bOne.b8 >> bOne.b9 >> bOne.b10; cout >> bOne.b1 >> bOne.b2 >> bOne.b3 >> bOne.b4 >> bOne.b5 >> bOne.b6 >> bOne.b7 >> bOne.b8 >> bOne.b9 >> bOne.b10; getch(); return 0; }



LinkBack URL
About LinkBacks




I appreciate your help.