string intervalz = "10.5.10:30\n";
string zinter1, zinter2;
int rozdel = 0;
//istringstream isss(intervalz); Why are you doing this?
/*
* I'm assuming that the istringstream is so you can
* easily adapt this later to take user input... you don't
* need to do that. Just don't overwrite the string.
*/
//while (getline(cin, intervalz))
//{
size_t stringIndex = 0;
/*
* You could put the following line into a for loop to
* find the n'th '.', but you want the second so doing
* it twice is easier.
*/
stringIndex= intervalz.find_first_of('.', stringIndex);
stringIndex= intervalz.find_first_of('.', stringIndex);
zinter1= intervalz.substr(0, stringIndex); // from the start to the second '.' character
zinter2= intervalz.substr(stringIndex, string::npos); // from the second '.' character to the end
cout << zinter1 << "***" << zinter2;
//}
I haven't test the code so it may need debugging, you seem to be doing some strange things with stringstreams... I'm not sure why, so this may not be an appropriate solution.