Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. int duza(char a){
  5. char b='a';
  6. b=toupper(a);
  7. if (a==b){
  8. return 1;
  9. }
  10. else {
  11. return 0;
  12. }
  13. }
  14.  
  15. int main() {
  16. FILE *f;
  17. FILE *fp;
  18. f=fopen ("lit.txt","r");
  19. if (f==NULL){
  20. printf("zly plik");
  21. }
  22. fp=fopen ("zapis.txt","w");
  23.  
  24. char x;
  25. while(feof(f)==0){
  26. x=fgetc(f);
  27. if(duza(x)){
  28. x=tolower(x);
  29. }
  30. else{
  31. x=toupper(x);
  32. }
  33. fprintf(fp,"%c",x);
  34. printf("%c",x);
  35. }
  36. fclose (f);
  37. fclose (fp);
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. #include <stdlib.h>
  45. #include <stdio.h>
  46.  
  47. int main(){
  48. FILE *fp;
  49. fp=fopen("zad.txt","r");
  50.  
  51. int x=0;
  52.  
  53. while(feof(fp)!=1){
  54. fgetc(fp);
  55. x++;
  56. printf("%c",fgetc(fp));
  57.  
  58. }
  59. fclose(fp);
  60. printf("%d\n",x);
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement