#include
#include
#include
using namespace std;
char u[200],U[200],F[200],X[200],a='a';
int DOU=1; //
void shuru();
void cunfang();
struct FF
{
char first[100];
char second[100];
bool flag;
};
int main()
{
shuru();
cunfang();
return 0;
}
void shuru()
{
cout<<"格式形如:"<B,C->D,B->D} AB" <
cout
cin>>U>>F>>X;
for(int i=0;i<strlen(F)-1;i++)
{
a=F[i];
if(a==',')DOU++;
}
}
void cunfang()
{
FF *ff=new FF[DOU];
int t=0,k=0,q=0; //t记录first个数 q记录second个数,k记录第几个
bool ww=false;
for(int j=1;j<strlen(F)-1;j++)
{
if(F[j]==','){
k++;t=0;q=0;
ww=false;
continue;
}else if(F[j]=='-'){
j+=2;
ww=true; //标记现在是second了;
}
if(!ww){
ff[k].first[t]=F[j];t++;}
else{
ff[k].second[q]=F[j];q++;}
}
for(int i=0;i<DOU;i++)
cout<<ff[i].first<<" "<<ff[i].second<<endl;
cout<<strlen(ff[0].first)<<" "<<strlen(ff[1].second)<<endl;
}
我想问下问什么第一个输出的字符数量不是1啊 剩下的那些是哪里来的?