output should like that:
input #: (909)869-2511
area: (909)
exchange: 869
ext.: 2511
#: (909)869-2511
Code:#include <iostream> #include <iomanip> #include <cstring> using namespace std; int main() { char sentence[32]; char *tokenPtr; tokenPtr = &sentence; cout << "Input Telephone No.: " ; cin >> sentence; tokenPtr = strtok( sentence, " " ); while ( tokenPtr != NULL ) { cout << tokenPtr << '\n'; tokenPtr = strtok( NULL, " " ); } return 0; }