Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. код на c++
  2.  
  3. /*подключенные библиотеки*/
  4. #include <cstdio>
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main ()
  10. {
  11. FILE * f;
  12. FILE *fp;
  13. int c;
  14.  
  15. if ( ! ( f = fopen("file.txt", "r") ) )
  16. { perror("oshibka otkrytija file.txt");
  17. cin.get();
  18. return -1;}
  19. if ( ! ( fp = fopen("rslt.txt", "wb") ) )
  20. { perror("oshibka otkrytija rslt.txt");
  21. cin.get();
  22. return -1;}
  23. cout<<"Schityvaem simvoly iz fajla file.txt i vstavljaem v rslt.txt, perevodja vse v VERHNIJ REGISTR";
  24. cout << endl;
  25. while ( ( c = fgetc(f) ) != EOF )
  26. {cout << ".";
  27. fputc( toupper(c),fp );
  28. }
  29. cout << endl;
  30. fclose(f);
  31. fclose(fp);
  32. cout<<"Rabota vypolnena, rezul'tat mozhno proverit' v fajle rslt.txt";
  33. cin.get();
  34. return ( 0 );
  35. }
  36.  
  37. _____________________________________________________________________________
  38.  
  39. код на c
  40.  
  41. #include <stdio.h>
  42. #include <ctype.h>
  43.  
  44. int main ()
  45. {
  46. FILE * f;
  47. FILE *fp;
  48. int c;
  49.  
  50. if ( ! ( f = fopen("file.txt", "r") ) )
  51. { perror("oshibka otkrytija file.txt");
  52. getchar();
  53. return -1;}
  54.  
  55. if ( ! ( fp = fopen("rslt.txt", "wb") ) )
  56. { perror("oshibka otkrytija rslt.txt");
  57. getchar();
  58. return -1;}
  59. printf("Schityvaem simvoly iz fajla file.txt i vstavljaem v rslt.txt, perevodja vse v VERHNIJ REGISTR");
  60. while ( ( c = fgetc(f) ) != EOF )
  61. {
  62. //printf(".");
  63. fputc( toupper(c),fp );
  64. }
  65.  
  66. fclose(f);
  67. fclose(fp);
  68.  
  69. printf("Rabota vypolnena, rezul'tat mozhno proverit' v fajle rslt.txt");
  70. getchar();
  71. return ( 0 );
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement