Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct{
- char kod[20+1];
- int iznos;
- int dan;
- int mjesec;
- int godina;
- int sat;
- int min;
- int sec;
- }kripto;
- struct dozvola{
- char kod1[20+1];
- int sat1;
- int min1;
- int sec1;
- int zbroj1;
- }lista1[30];
- int main()
- {
- char unos[5]={0};
- int i,j=0,l,a=0,d,b;
- kripto tmp;
- FILE *fo=NULL;
- fo=fopen("creepto.val","rb");
- if(fo == NULL) exit(1);
- scanf("%s",unos);
- l=strlen(unos);
- while(!feof(fo)){
- fread(&tmp,sizeof(kripto),1,fo);
- j=0;
- for (i=0;i<l;i++){
- char *slovo=strchr(tmp.kod,unos[i]);
- if(slovo != NULL){
- j++;
- if(j==l){
- b=(tmp.sat*3600)+(tmp.min*60)+tmp.sec;
- strcpy(lista1[a].kod1,tmp.kod);
- lista1[a].sat1=tmp.sat;
- lista1[a].min1=tmp.min;
- lista1[a].sec1=tmp.sec;
- lista1[a].zbroj1=b;
- a++;
- }
- }
- }
- }
- int temp;
- int m;
- for(m=0;m<(a-1);m++){
- for (d=0;d<(a-m-1);d++){
- if (lista1[d].zbroj1>lista1[d+1].zbroj1){
- temp=lista1[d].zbroj1;
- lista1[d].zbroj1=lista1[d+1].zbroj1;
- lista1[d+1].zbroj1=temp;
- }
- }
- }
- for(m=0;m<a;m++){
- for (d=0;d<a;d++){
- if (lista1[m].zbroj1==lista1[d].zbroj1){
- printf("%s@%02d:%02d:%02d\n", lista1[d].kod1, lista1[d].sat1, lista1[d].min1, lista1[d].sec1);
- }
- }
- }
- fclose(fo);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement