Hi, I'm trying to find a way to extract numbers from a text consisting of words and numbers but have no idea how to do it. The numbers can be larger than one digit and should be able to be manipulated by common math operators like +, - and / after the extraction from the text. Should I go through the text as a string considering the numbers I want to extract is larger than one digit or as chars? And is it possible to turn the numbers to an int after I extracted them from the text so I can do math things with em?
like:
mcDonalds car 456 burgerKing 8 clowns are scary money leeking from 56 my pockets I like turtles 1
456, 8, 56, 1 I want to extract these numbers from the text and turn it into int so i can do something like this:
int value = 0;
loop{
value = value + extracted_number ;
}
cout << " The total value of the numbers is: " << value;
The total value of the numbers is: 521
I'm kind of new to programming and all..., you guys have any ideas?