I am trying to process a string with a random size, and modify all numbers surrounded by certain patterns. For example,
string oldstring = "res 0.25 cap 0.12 tra 1 res 0.3 cap"; string newstring = "res 0.50 cap 0.12 tra 1 res 0.6 cap";
So all the numbers between "res" and "cap" were multiplied by 2. I only know how to search for a particular substring (using stringstream, token, while loop and getline), but I am not sure how to search for a pattern like "res ... cap" and modify the number between them.
Could anyone give me some guidance?