#include <iostream>
using namespace std;
int main()
{
int i,j,k,w;
char mych[20];
cin>>mych;
char ch1[10];
char ch2[10];
char ch3[10];
for( i=0,j=0,k=0,w=0;i<20&&mych[i]!='\0';i++)
{
if((mych[i]>='a'&&mych[i]<='z')||(mych[i]>='A'&&mych[i]<='Z'))
{
ch1[j]=mych[i];
j++;
}
else if((mych[i]>='0'&&mych[i]<='9'))
{
ch2[k]=mych[i];
k++;
}
else
{
ch3[w]=mych[i];
w++;
}
}
ch1[9]='\0';ch2[9]='\0';ch3[9]='\0';
cout<<"字符数组ch1的值为:"<<ch1<<endl;
cout<<"字符数组ch2的值为:"<<ch2<<endl;
cout<<"字符数组ch3的值为:"<<ch3<<endl;
return 0;
}
AAnonymous
相关分类