读书人

关于数据结构算法解决方法

发布时间: 2012-03-18 13:55:38 作者: rapoo

关于数据结构算法
以下是一条公司出的题目,求答案:
Data Structure
Giving the following requirements:
Favorite sport - enum(baseball, hockey, football, soccer, basketball)
Hours Training - number from 0 to 50
Favorite Team - enum(Canadiens, Nordiques)
Favorite color - enum(black, white, blue, red, yellow, green, brown, pink)

what would be the bit representationusing the most optimal algorithm of the following choices:
hocky, 7, canadiens, red

[解决办法]

C/C++ code
struct XXX{        char Sport :4;        char Color :4;        char Hours :6;        char Team  :1;}; 

读书人网 >C++ Builder

热点推荐