initial checkin from subversion

This commit is contained in:
Tretter
2017-02-07 20:03:49 +00:00
commit ed54469421
108 changed files with 1999 additions and 0 deletions

41
xto10.c Normal file
View File

@@ -0,0 +1,41 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
unsigned long base10;
int oldbase;
char c[100];
unsigned long rest,erg;
int pos=0;
int i;
int main()
{
base10=0;
oldbase=36;
for(i=0;i<100;c[i++]=0);
printf("Altes Zahlensystem:");
scanf("%d",&oldbase);
printf("Zahl im %der-System:",oldbase);
scanf("%s",&c);
pos=0;
while(c[pos++]);
pos--;
int len=pos-1;
while(pos--)
{
if(isdigit(c[len-pos]))
{
base10 = base10 + (unsigned long)( (double)(c[len-pos]-'0') * ( pow( (double)oldbase,(double)pos ) ) ) ;
printf("-N-DEBUG: base10:%d, c:%c, pos:%d\n",base10,c[pos],pos);
}
else
{
base10 = base10 + (unsigned long)( ((double)(c[len-pos]-'A')+10) * ( pow( (double)oldbase,(double)pos ) ) );
printf("-A-DEBUG: base10:%d, c:%c, pos:%d\n",base10,c[pos],pos);
}
}
printf("Zahl im 10er-system:%d\n",base10);
}