用strtok分割函数
#include<iostream>
#include<cstring>
#include<iomanip>
using namespace std;
int main()
{
char x[] = "(025)872346865-987";
char* temp;
char *k;
temp = strtok_s(x+1, ")",&k);
int quhao = atoi(temp);
temp= strtok_s(0, "-",&k);
int dianhua = atoi(temp);
temp = strtok_s(0, "\0",&k);
int fengjihao = atoi(temp);
cout << "区号:"<< set(3)<<quhao<<"电话:"<<dianhua <<"分机号:"<< fengjihao<<endl;
return 0;
}