Pagini recente » Cod sursa (job #1494396) | Cod sursa (job #799696) | Cod sursa (job #684896) | Cod sursa (job #993686) | Cod sursa (job #170137)
Cod sursa(job #170137)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream.h>
#include <conio.h>
int sort_function( const void *a, const void *b);
char list[36000][17];
int main()
{
ifstream f("restante.in");
ofstream g("restante.out");
int x,n,k,y;
f>>n;f.get();k=n;
for(x = 0; x < n; x++)
{ f.get(list[x],17);
qsort((void *)list[x], strlen(list[x]), sizeof(list[x][0]), sort_function);
f.get();
}
for(x=0;x<n-1;x++)
{
if(strcmp(list[x],NULL)==0) x++;
else
for(y=x+1;y<n;y++)
if(strcmp(list[x],list[y])==0)
{ strcpy(list[y],NULL);
k-=1;
}
}
g<<k-1;
return 0;
}
int sort_function( const void *a, const void *b)
{
return( strcmp((char *)a,(char *)b) );
}