The site is loading…

https://docs.google.com/document/d/1R_rYGMRvzEaBQeMp0OtLd6v3L3-ajliMKf4YOBGnMcE/edit

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <time.h>
  5.  
  6. void kiir(int n, int *a);
  7.  
  8. int main(){
  9. 	int * input;
  10. //	int i;
  11. 	int i = 1;
  12. 	int ertek;
  13. 	int j;
  14. 	srand(time(NULL));
  15. 	int x = sizeof(int);
  16. 	int y = sizeof(int);
  17. 	input = (int *) malloc(x);
  18. 	for(j = 0; j < i; j++){
  19. 		printf("Kerem az erteket: ");
  20. 		scanf(" %d", &ertek);
  21. 		if(ertek>0){
  22. 			input = realloc(input, y);
  23. //			input[j] = rand() % 100;
  24. 			input[j] = ertek;
  25. 			y = y + x;
  26. 			i++;
  27. 		}
  28. 	}
  29. 	kiir(i, input);
  30. 	return 0;
  31. }
  32.  
  33. void kiir(int n, int *a){
  34. 	int i;
  35. 	for(i = 0; i < n; i++){
  36. 		printf("Az %d. elem: %dn", i , a[i]);
  37. 	}
  38. }
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <errno.h> // hibakezel괨ez
  4. #include <dirent.h>
  5. #include <sys/types.h>
  6. #include <string.h>
  7. #include <sys/stat.h>
  8.  
  9. void konyvtar(char form[], char di[]){
  10. 	DIR * D;
  11. 	struct dirent * direntp;
  12. 	struct stat my_status;
  13. 	char new_form[80];
  14. 	char new_form_s[80];
  15. 	char fname[80];
  16. 	strcpy(new_form, form);
  17. 	strcat(new_form, "t ");
  18. 	strcpy(new_form_s, form);
  19. 	strcat(new_form_s, "%sn");
  20.  
  21. 	chdir(di);
  22. 	D = opendir(".");
  23. 	if(!errno){
  24. 		// könyvtár nyitva, olvassuk
  25. 		while((direntp=readdir(D))!=NULL){
  26. 			strcpy(fname, direntp -> d_name);
  27. 			printf(new_form_s, fname);
  28. 			if((strcmp(fname, ".")!=0) && (strcmp(fname, "..")!=0)){
  29. 				stat(fname, &my_status);
  30. 				if(S_ISDIR(my_status.st_mode)){
  31. 					strcat(new_form, "t");
  32. 					konyvtar(new_form, fname);
  33. 				}
  34. 			}
  35. 		}
  36. 	}
  37. 	closedir(D);
  38. }
  39.  
  40. int main(){
  41. 	char D[80] = ".";
  42. 	printf("Az aktualis konyvtar tartalma: n");
  43. 	konyvtar(" ", D);
  44. 	return 0;
  45. }

Continue reading