Microsoft Interview Question
Software Engineer in TestsWhat about std::map?
//data structure we need
map<char*, string> opts1; //the opts which take arguments
map<char*, int> opts2; //the opts which doesn't need arguments, e.g, -R
//algorithm
step 1: first insert all the legal opts into two maps
step 2: parse the input, if illegal or duplicate opts found, return false
step 3: set the corresponding value
wtf?
- Anonymous January 27, 2010