Memory constrained embedded systems, IoT devices cannot have liberty to use lots of
memory. You are tasked to store the result of a NUCES-FAST student in one single variable. This can
be done using all bits of that variable in an efficient way. Write a program which prompts user to enter
the following student data and convert all this information to store in a single variable (see sample run).
Use bitwise AND, OR and SHIFT operators. Also use if-else where needed. (20 marks)
23-29 (7 bits) Calculus Marks 3-digit value 1010101 (85)
30-36 (7 bits) PF marks 3-digit value 1011100 (92)
37-43 (7 bits) English marks 3-digit value 1001110 (78)
44-50 (7 bits) Physics marks 3-digit value 1000101 (69)
51-52 (2 bits) CGPA – integer part 1-digit value 11 (3)
53-59 (7 bits) CGPA – fractional part 2-digit value 0010110 (22)
60-63 (4 bits) Not used (reserved) 0000
Binary number stored 0000001011011100010110011101011100101010100011010111100001010101
Decimal Equivalent 206138463618955349
int main() {
int NUCESFAST = 10;
int* b = &NUCESFAST;
cout << &NUCESFAST;
}
Comments
Leave a comment