64,683
社区成员
发帖
与我相关
我的任务
分享
#include<iostream.h>
#include<string.h>
#include <fstream.h>
#include<windows.h>
#include <stdio.h>
void main()
{
char man[100][100],woman[100][100];
int i,j,k,m;
// char a[256],b[256];
i=j=0;
k=1;
for( m=0;m <100;m++)
{
strcpy(man[m],"null");
strcpy(woman[m],"null");
}
ifstream fin("shuju.txt");
char c[128],d[128];
while(fin>>c)
{
fin>>d;
if(strcmp(d,"nv"))
{
strcpy(man[i],c);
i++;
cout<<"nan"<<c<<endl;
cout<<"nan"<<man[i]<<endl;
}
if(strcmp(d,"nan"))
{
strcpy(woman[j],c);
j++;
cout<<"nv"<<c<<endl;
cout<<"nv"<<woman[j]<<endl;
}
} fin.close();
}
ifstream fin("shuju.txt");
char c[128],d[128];
while(fin>>c)
{
fin>>d;
if(strcmp(d,"nv"))
{
strcpy(man[i],c);
cout<<"nan"<<c<<endl;
cout<<"nan"<<man[i]<<endl;
i++;
}
if(strcmp(d,"nan"))
{
strcpy(woman[j],c);
cout<<"nv"<<c<<endl;
cout<<"nv"<<woman[j]<<endl;
j++;
}
} fin.close();