求教高手
#include <stdio.h>#include <string.h>
#define SIZE 5
struct ip_net
{
char IP[SIZE];
char NET[SIZE];
}network[5]={
{"du",54},
{"du",67},
{"wang",87},
{"wang",56},
{"we",90}
};
void main()
{
int i,j,index;
index=16;
for(i=0;i<5;i++)
{
for(j=0;j!=i,j<5;j++)
{
if(strcmp(network[i].IP,network[j].IP)==0)
index--;
}
}
printf("%d\n",index);
}
如何计算不同的名字个数??
----------------解决方案--------------------------------------------------------
先按名字排序````在统计
----------------解决方案--------------------------------------------------------