Re: US Military Dead during Iraq War
- From: "¬a\\/b" <al@xxx>
- Date: Sun, 28 Aug 2005 06:09:07 GMT
On Sun, 21 Aug 2005 19:48:58 +0200, Herbert Kleebauer <klee@xxxxxxxxx>
wrote:
>Frank Kotler wrote:
>> Herbert Kleebauer wrote:
>>
>> ...
>> > Please post your source code.
>>
>> Ahhh... ooookay... Jesus, are you sure you want this? This is the
>> ugliest cruft you're ever likely to see posted here.
>
>That's perfect. So we can use this example as a prove, that C
>programs are much easier to read than assembler programs.
>
>
>> Seems like a flaw in the basic scheme...
>
>This wasn't designed as a ROT13 replacement, but as an attempt
>to persuade Beth to do some assembly programing instead of
>only political discussing. I choose the scheme because the
>code you posted a few weeks ago could be used as a staring
>point.
>
>
>>
>> Remember, folks, Herbert *asked* me to dump my trash here!
>
>And here the source of a C solution which should run on
>any processor and any OS.
>
>
>#include <stdio.h>
>FILE *in,*out,*fopen();
>
>main()
>{int i,j,k,count[53]={0},xlat[256];
>
> in= fopen("input.txt","r");
> out=fopen("output.txt","w");
>
> while ((i=getc(in))!=EOF)
> {if (i>='A' && i<='Z') count[i-'A']++;
> else if (i>='a' && i<='z') count[i-'a'+26]++;}
>
> j='A'; for (i= 0;i<26;i++) count[i] = (count[i]<<8) + j++;
> j='a'; for (i=26;i<52;i++) count[i] = (count[i]<<8) + j++;
>
> for (i=0;i<51;i++)
> for (j=i+1;j<52;j++)
> if ((k=count[i])<count[j]){count[i]=count[j]; count[j]=k;}
> count[52]=count[0];
>
> for (i=0; i<256; i++) xlat[i]=i;
> for (i=0; i<52; i++) xlat[(count[i]&0xff)]=count[i+1]&0xff;
>
> fseek(in,0,0);
> while ((i=getc(in))!=EOF) putc(xlat[i],out);
>}
all this seems not ok; i use these functions here for see what is it
#define U unsigned
void print_xlat1(int* xl, int *h)
{int i;
for (i=0; i<52; i++)
printf("%c->%c|", (char)(h[i]&0xff), (char) xl[(h[i]&0xff)]);
printf("\n");
}
void print_count(int* h)
{int i;
for(i=0; i<52; ++i)
printf("%c:%u|", (char)(h[i]&0xFF), ((U)h[i]>>8));
printf("\n");
}
I have a file and these are the letter counts
e:319|a:183|p:174|c:162|d:147|s:134|x:131|o:115|l:115|i:114|r:109|b:92|u:83|m:83
|t:79|n:75|f:62|h:52|v:46|j:26|g:19|y:15|w:8|k:5|T:5|A:5|P:4|D:4|q:3|R:3|N:3|E:3
|z:2|X:2|U:2|O:2|C:2|Z:1|Y:1|W:1|V:1|S:1|Q:1|M:1|L:1|K:1|J:1|I:1|H:1|G:1|F:1|B:1
then the prog above seems does
e->a|a->p|p->c|c->d|d->s|s->x|x->o|o->l|l->i|i->r|r->b|b->u|u->m|m->t|t->n|n->f|
f->h|h->v|v->j|j->g|g->y|y->w|w->k|k->T|T->A|A->P|P->D|D->q|q->R|R->N|N->E|E->z|
z->X|X->U|U->O|O->C|C->Z|Z->Y|Y->W|W->V|V->S|S->Q|Q->M|M->L|L->K|K->J|J->I|I->H|
H->G|G->F|F->B|B->e|
the result should be a file where ^^^
a:319|p:183|c:174|d:162|s:147|x:134|o:131|l:115|i:115|r:114|b:109|u:92|t:83|m:83
|n:79|f:75|h:62|v:52|j:46|g:26|y:19|w:15|k:8|T:5|P:5|A:5|q:4|z:3|R:3|N:3|E:3|D:4
|Z:2|X:2|U:2|O:2|C:2|e:1|Y:1|W:1|V:1|S:1|Q:1|M:1|L:1|K:1|J:1|I:1|H:1|G:1|F:1|B:1
i think i know inverse if i can know a way to order last file
frequency for know the first file *frewuency order*
how can i from u:92|t:83|m:83 know that in the origin file i have
u|m|t. Why it can not be u|t|m ?
how from u:92|t:83|m:83|n:79 (file2) => u|m|t|n (file1)?
note that u>t>m<n
You can note that from
o:131|l:115|i:115|r:114| (file 2) => |o|l|i|r (file1)?
note that o>l>i<r
why in the first case there is one swap and in the last not?
.
- Follow-Ups:
- Re: US Military Dead during Iraq War
- From: Herbert Kleebauer
- Re: US Military Dead during Iraq War
- References:
- Re: US Military Dead during Iraq War
- From: Herbert Kleebauer
- Re: US Military Dead during Iraq War
- From: Herbert Kleebauer
- Re: US Military Dead during Iraq War
- From: Frank Kotler
- Re: US Military Dead during Iraq War
- From: Frank Kotler
- Re: US Military Dead during Iraq War
- From: Herbert Kleebauer
- Re: US Military Dead during Iraq War
- From: Frank Kotler
- Re: US Military Dead during Iraq War
- From: Herbert Kleebauer
- Re: US Military Dead during Iraq War
- Prev by Date: Re: Hutch, give it up.
- Next by Date: Re: US Military Dead during Iraq War
- Previous by thread: Re: US Military Dead during Iraq War
- Next by thread: Re: US Military Dead during Iraq War
- Index(es):
Relevant Pages
|