The purpose of this code is to extract a double from a String.
Well, I'm not sure if i'm progressing well, but it's too make the user input any number such as 150,000,000.00 with the exact same output. It does that, but what IF a user decides to input 1333333, that would not be considered validated. Do I make a boolean case for that situation? or a While loop to somehow check if the user is inputting comma's/decimal correctly?
Any advice/tip/critique is well appreciated. Code:(a bit messy, since I was experimenting)
line 15 number = atof(myStr); what is this supposed to do? you don't use number anywhere that I can see and if the input is 150,000,000.00 number will equal 150.00 Is that what you wanted?
line 26 what is this supposed to do? distance = numDigits - i - 1; you don't use distance anywhere in your code.
what is tempstr for? You put stuff in it but you never output its contents. If the input is 150,000,000.00 tempsting will contain 150,,00,0,0,00.,00
line 20 int numDigits = strchr(myStr, '.') - myStr; this line counts the number of digits before the '.' but it is counting the ',' as digits is that what was intended?