You haven't still bother to indent correctly your sourcecode at here. And you haven't made any commend to your pieces. That's really bad coding style! So you expect that someone will dig through your code?
Your indenting is inconsistent, which makes it very difficult to follow the code's logical structure. Things in the same block of code should essentially be at the same indentation.
I haven't gone in depth through your strToDouble(string s) function, but I would encourage you to consider a different logical approach. As far as I can see, your string has to end in EITHER
" OR
m
So start by looking at the s.length()-1 element (assuming there are no blanks at the end - trim them off if so; in fact it might be a good idea to remove ANY spaces first).
You now know whether it is in metric or imperial measurement. Take the last element off the string.
If it is metric, then the rest of the string can be converted to a double (e.g. with a string conversion function, or use of stringstream). That is then done.
If it is imperial, then the truncated string will be of form
a'b
This string can be SPLIT and a and b can separately be converted to the equivalent doubles. If these are A and B then the total length in metres is ( A + B/12.0 ) * 0.305
There isn't any code here, but perhaps the simpler approach may lead to less coding errors.
The logic for strToDouble() is hard to follow, which makes it hard to debug. I'd recommend simplifying it by breaking it into smaller pieces with clear, specific purposes.
Does the assignment require strToDouble() identify the format AND convert meters to feet/inches AND split up feet inches? If not, write smaller helper functions to divvy up the tasks.
For example, strToDouble() could call other functions that
1) scan for 'm'
2) extract meters from string
3) convert meters to ft/in
4) extract ft/in from string
Each one of those functions will be easier to debug than all of them combined into a single for loop.
As a side note, what does the "magic" variable in Distance refer to? Is it the distance in inches? Is it the distance in meters? Does it change depending on circumstances?
I propose that it's easier to store the Distance value in meters regardless of the format provided. It'll require that you convert feet/in, but once it's converted comparisons become very simple.
I have not tried this yet, but my thought is in the if statements starting at line 29.
Move line 33 to line 29 and make it just if and move line 29 to line 33 and make it an else if and I think it should work better.