[EMAIL PROTECTED] wrote:
> BTW, just for kicks to compare languages, how would one implement the
> same "lookup" table using C/C++?  It would be a good lesson in high
> level vs. lower level programming....
> 
Something vaguely like:

unsigned char hwdict[89 - 60][401 - 80];

int
setsize(int height, int weight, int size)
{
     int result; /* non-zero (old size) if changes an already set size */

     assert(60 <= height && height<= 88 && 80 <= weight && weight<= 400);
     result = hwdict[height - 60][weight - 80];
     hwdict[height - 60][weight - 80] = size;
     return result;
}

int
getsize(int height, int weight, int size)
{
     assert(60 <= height && height<= 88 && 80 <= weight && weight<= 400);
     return hwdict[height - 60][weight - 80];
}

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to