Törölt nick Creative Commons License 2002.06.22 0 0 43
Az elsô feladatot így oldanám meg:

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

int srt( const void *a, const void *b) {
if ( *(int*)a == *(int*)b ) {
return 0;
}
else if ( *(int*)a < *(int*)b ) {
return 1;
}
return -1;
}

int main() {
int lst[10];
int i;
printf("\nAdja meg a szamokat:\n");
for (i=0; i<10; i++) {
scanf("%d", &lst[i]);
}
qsort((void *)lst, 10, sizeof(lst[0]), srt);
printf("\nA rendezett lista:\n");
for (i=0; i<10; i++) {
printf("%i ",lst[i]);
}
return 0;
}


Ez pedig a második:

#include <conio.h>
#include <stdio.h>
#include <ctype.h>

int fgv(const char *str) {
while (*str++) {
if (isdigit(*str)) return 1;
}
return 0;
}

int main() {
char buff[83];
buff[0] = 81;
fgv(cgets(buff)) ? printf("\nVan ") : printf("\nNincs ");
printf("benne szamjegy!\n");
return 0;
}

Előzmény: Sight (41)