spliting line

I have question about how to read line and i want to spit it by string and int

Rt 72 and Randall 42.1032143 88.3349228
I-90 and Randall 42.0804138 88.3352737
Big Timber and Randall 42.0650063 88.3356094

i have file call map and i want to read that after read file i have to separate it by string and int.
then i have compare

if ( int == 42.103...)
{ ......}

but all i get is separate word i whole Rt 72 and Randall than 42.1032143 and 88.3349228 separate by tab . I am not getting right output.
need help please....
1
2
3
4
5
6
7
8
9
std::istringstream is( "Rt 72 and Randall 42.1032143 88.3349228" );

std::string s;

while ( is >> s )
{
   if ( isdigit( s[0] ) ) std::cout << std::stod( s ) << std::endl;
   else std::cout << s << std::endl;
}
I don't wanna
Rt
72
and
Randall
42.1032
88.3349

separate like this i want "Rt 72 and Randall" and "42.1032" and "88.3349" separate . I have whole file with address and integer at the and(100 lines) . I want to separate this.

Topic archived. No new replies allowed.