Implement a function which iterates over the 7 digit phone number (one digit at a time) and checks if it's the same as the digit before. I suggest converting the phonenumber to string for easier manipulation.
Here's a short example (not the complete solution;)
bool hasDoubleDigits( int phoneNumber )
{
//convert int to string
std::string phoneNumberSring;
// iterate over string
for( unsigned i=0; i!=phoneNumberString.size()-1;++i )
{
//check if phoneNumberString.at(i) == phoneNumberString.at(i+1)
//return true
}
// no doubledigits found, return false
}
Topi Ojala
Junior Poster in Training
66 posts since May 2009
Reputation Points: 13
Solved Threads: 20
Skill Endorsements: 0