Auf ein neues:
1.
#include<stdio.h>
int main()
{
int a;
a=0;
while(a<=127)
{
if(a<=32)
printf("%3d %2.2x %8.8b\n",a,a,a);
else
printf("%3d %2.2x %8.8b %c\n",a,a,a,a);
a++;
}
getch();
}
2.
#include<stdio.h>
#include<ctype.h>
int main()
{
int c = 0;
while(c!=3)
{
printf ("Taste druecken:");
c=getch();
if((1<=c && c<3) ||(3<c && c<33) ||(32<c && c<48) ||(57<c && c<65) || (90<c && c<97) || (122<c && c<127))
printf (" %2.2x %c Zeichen\n\n",c,c);
else if((64<c && c<91) || (96<c && c<123))
printf (" %2.2x %c Buchstabe\n\n",c,c);
else if(47<c && c<58)
printf (" %2.2x %c Ziffer\n\n",c,c);
}
}
(Das ist das ganz erste)
3.
#include<stdio.h>
#include<string.h>
int main()
{
char s[30];
int n = 1;
while(n!=0)
{
fgets(s,30,stdin);
s[strlen(s)-1]='\0';
n=strlen(s);
printf("%d Zeichen \n",n);
if(n==0)
{
printf("Keine Zeichen eingegeben!\n");
break;
}
}
getch();
}
4.
#include<stdio.h>
#include<string.h>
int main()
{
char v[80],n[80],z[200];
int s = 1;
while(s!=0)
{
printf("Vorname\n",v);
fgets(v,80,stdin);
v[strlen(v)-1]='\0';
s=strlen(v);
if(s==0)
{
break;
}
printf("Nachname\n");
fgets(n,80,stdin);
s=strlen(n);
n[strlen(n)-1]='\0';
strcpy(z,v);
strcat(z," ");
strcat(z,n);
printf("Danke fuer deine Mitarbeit, %s!\n",z);
}
getch();
}
5.
#include<stdio.h>
int main()
{
FILE *out;
int z;
z=0;
out=fopen("ASCIITAB.txt","w");
while(z<=127)
{
if(z<=32)
fprintf(out,"%3d %2.2x %8.8b\n",z,z,z);
else
fprintf(out,"%3d %2.2x %8.8b %c\n",z,z,z,z);
z++;
}
fclose(out);
getch();
}
6.
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
char w[80], d[80], e[80];
FILE *vok;
int anz;
vok=fopen("vokabel.dat","r");
if (vok==0)
{
printf("Uebersetzungsdatei nicht vorhanden!!!\n");
return 1;
}
printf("zu uebersetzendes Wort:");
scanf("%s", w);
while( (strcmp(w,"fine") !=0 ) && (strcmp(w,"aus") !=0) )
{
while (1)
{
anz=fscanf(vok, "%s %s", d, e);
if (anz == 1)
break;
if (anz ==2)
{
if(strcmp(w, d) == 0)
{
printf("Englisch: %s\n\n", e);
break;
}
if(strcmp(w, e) ==0)
{
printf("Deutsch: %s\n\n", d);
break;
}
}
else
{
printf("Keine Uebersetzung gefunden\n\n");
break;
}
}
rewind(vok);
printf("zu uebersetzendes Wort:");
scanf("%s", w);
}
fclose(vok);
}
