output should like that:

input #: (909)869-2511
area: (909)
exchange: 869
ext.: 2511
#: (909)869-2511

this is my code so far:
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;
}

Last edited by shabbir; 4Jun2009 at 08:45.. Reason: Code blocks