1. What files should I submit?
Answer: .cpp .h and some additional file such as .exe .txt.
You could use winzip or winrar to compress them.
2. When is the due time?
Answer: 13:00PM
3. For Q1, why are the compacted values 16 bits each?
Answer: Because the maximum result of the calculation of 3 units are 36+36*40+36*40*40=59026 (in decimal), while FFFF (in hexdecimal) is 65535 (in decimal) which is the maximum number in 16 bits (one number is 4 bits, one char is 8 bits), so using 16 bits is enough to express the result.
4. It says that the compacted user id will be a string of 48 bits - so must I convert the compacted values to string? i.e. convert the integer values into hexadecimal and then convert that to string?
Answer: The compacted value should be hexidecimal number. You could convert the compacted value to string. Input a string (for example ABCD1234), using array to get 8 chars, calculate the result (ABC to 1311,D12 to 69A4, 234 to 04F6) then the result is 131169A404F6, you could output them as a string (convert the hexdecimal to substring then combine the substring to a string).
5. To convert the chars to number (A to 1, B to 2...), How?
Answer: Some students use Case, that's not the best choice since we could use
ASCII code.
If the X (variable) 's ASCII is between 97 and 122, use ASCII(X) - 96,
If the X (variable) 's ASCII is between 65 and 90, use ASCII(X) - 64,
If the X (variable) 's ASCII is between 48 and 57, use ASCII(X) - 21,
6. My output is 1311 69A4 4F6 or 131169A44F6, is
that good?
Answer: Not so good, the first is 52 bits, the second is 44 bits.
7. For Q2, is the output unique?
Answer: It is. For example : x1 + x2*40 + x3*40*40=53387 though there are
three variables. they are in the range(1-36). since 36<40 so x1,x2,x3 are
unique. Max(x3)=(53387-1-1*40)/1600< 53387/1600 Min(x3)=(53387-36-36*40)/1600>
53387/1600 -1.
when you use the rules to reverse the ASCII code to chars.
the answer of the variables are unique because actually the rules are using Forty_decimal.
You could use x3=(53387)%(1600), x2=(53387-x3*40*40)%40, x1=53387-x3*1600-x2*40;
8. But still, it cannot be decide it is Lowercase or Capital.
Answer: right, so the output could be either Lowercase or Capital.
9. How to input one hexadecimal string . Input on 3 lines to output the final string. Is this OK?
Answer: the input is a string with 12 chars (like 123A567800B2),treat them as hexidecimal. convert them to decimal with each 4 of them, 123A to 1*16*16*16 + 2*256 + 3*16 + 12 = 4668, convert 4668 to the substring(Z9B). then next 4, then last 4. the result will be Z9BP6MRD. using an array (char userIdHex[12]) to get the chars in the input string. like the Q1.
10. For Q4, How to construct a 2-D space in code.
Answer: You could input the center(x1,y1) and the radius (r) of the circle, then input a point(x2,y2). then judge the point is inside or outside or tangent. if you could print the graph on the screen, that's better. or just describe it.
11. I need some new class
to convert string to Decimal, Decimal to Hex_decimal, Hexdecimal to Decimal,
Hexdecimal to string, char to ASCII,
ASCII to char... Where could I get them.
Answer: The Help documents of VC++ (MSDN) or Borland C++ could help
you, the MSDN could be found on http://msdn.microsoft.com/library
Or using Google. Or write a class in the code.