| roovraven (11) | |
|
My problem is: having a file like this Begin .... .7.235...8.9345 .....pinco pallino is tall 1.82 ... ..8.345.. ... end Begin ...34.345.. ... ....tizio is tall 1.68 and so on I have to read a double number in input from the user and find it in the file when following "is tall" (with a tolerance of +/-0.01). Once I find "is tall myNumber" I have to output all the section that contains my recognition string that goes from "begin" to "end". I am now developing a code that, given the number, generate three numbers(the same, increased of 0.01 and decreased of 0.01) and render these in arrays of characters. My intention is to read every section starting with "begin" and stopping with "end" as a string array and using function find to focus on my recognition string using my three numbers (that now have become strings) 1)Can I use static_cast<string> on an array of carachters? 2)Is there a simpliest way, for exemple using the number as it is and using function fabs? 3) In case this is possible how can I retrieve the text from "begin" to "is tall x.xx"? | |
|
|
|
| kbw (5520) | ||||
| ||||
|
Last edited on
|
||||
| roovraven (11) | |
| So should I convert a string in a number? How can I do that? | |
|
|
|