.


:




:

































 

 

 

 





. :

1. .

2. .

3. .

4. .

: . , .

, , , , . , , . . , . , , .

, . - , , , .

, , ( ).

1. ( ).

2. .

. , , .

, . , . , , . , . . (), ( , ), .

1. . .

#include "stdafx.h"#include <iostream>using namespace std;#include <conio.h> #include <ctype.h> #include <io.h> #define SIZE 40 int _tmain(int argc, _TCHAR* argv[]){ char *buffer,str[SIZE],*pt,*qt,c; long n; int i,k,len; FILE *f; f = fopen("copy.txt","r+"); // "r" '+' printf("\n \n"); c = getchar(); scanf("%d",&k); n = filelength (fileno(f)); // len = (int)n-1; // buffer = (char*)malloc(len); fread(buffer, len,1,f); fseek(f,0L,SEEK_SET); /* fread , */ // pt = buffer; while(*pt++); qt = pt + 1; // 1 for (i = 0; i < len - k + 1; i++) // *qt-- = *pt--; buffer[k - 1] = c; // , fwrite(buffer, len,1,f); fseek(f,0L,SEEK_SET); // fwrite fscanf(f,"%s",str); printf("\n C %s",str); system("pause"); return 0;}

2. . .

#include "stdafx.h"#include <iostream>using namespace std;#include <io.h> #include <stdlib.h> #include <conio.h> #include <ctype.h> #define SIZE 2000 int _tmain(int argc, _TCHAR* argv[]){ FILE *f1, *f2; char str[SIZE],c; int i,n; f1 = fopen("copy1.txt","w"); f2 = fopen("copy.txt","r"); printf("\n \n"); scanf("%d%s",&n,str); if (n > 0 && n < (int)filelength (fileno(f2))) { // i = 1; // while(i < n && feof(f2) == 0) { c = getc(f2); putc(c,f1); i++; } fputs(str,f1); // // while(feof(f2) == 0) { c = getc(f2); if (c!=-1) putc(c,f1); } } // if else printf("\n (%d)",n); system("pause"); return 0;}

 

, , .

1. ( ).

2. .

3. .

4. .

5. .

6. .

 

4. .

#include "stdafx.h"#include <iostream>using namespace std;#define BSIZE 200 int _tmain(int argc, _TCHAR* argv[]){ char arg[20]="task.txt"; char buf[BSIZE]; int ch; FILE *in, *tmp; in=fopen(arg,"rb"); if(in==NULL) printf(" %s\n", arg); else { tmp = tmpfile(); buf[0]='\t'; while(fgets(buf+1,BSIZE-1,in)!= NULL) fputs(buf,tmp); fclose(in); in = fopen(arg,"wb"); fseek(tmp,0l,SEEK_SET); while ((ch=fgetc(tmp))!= EOF) fputc(ch,in); fclose(in); fclose(tmp); } system("pause"); return 0;}

 

.

++, .

, , , , .

 

5. :

:

1) ;

2) .

6. :

1. : , , . ( ) .

2. , , : , , , . .

3. : , , , , . , , 50%.

4. , . , , .

5. : , , , . . : .

6. : , , . , .

7. : , , , . .

8. : , , , . , .

9. : , , . , , .

10. : , , , . .

11. : , , , . , .

12. : , , , , . .

13. : , , , . , , .

14. , : () , , , . , .

15. , , : , , , (, , ..), , . , .

16. , : , , . , .

17. , : , , . .

18. , : , , , . .

19. , : , , . .

20. , : () , , . , .

21. , : , , . , .

22. , : , , , . , .

23. , : , , . , , .

24. , : , , , , . ( = 50 ).

25. : , , . .

26. : , , , , . , .

27. : , , ( ). , .

28. : , , ( ). , 4 5.

29. : , , ( ). , , 4.0.

30. : , , , . 1- .

 

.

1) ? /?

2) /, .

3) ?

4) fopen()?

5) ? .

6) -?

7) , ? ?

8) ?

9) ?

10) ?

11) fseek()?

12) ?

13) ?

14) ? ?

15) ? ?

 

.

 

:

1. . . []: / .. . - .: -, 2008; .: , 2008. - 352 .: . - ISBN 978-5-8199-0355-1: 157.41

2. . . [Text]: / ..; . . . ... - .: : -, 2009. - 416 .: . - ISBN 978-5-16-002690-9: 116.05

3. . . /++ [Text] / ... - .: , 2009. - 461 .: . - ISBN 978-5-94723-568-5: 176.99

5. , . . /++ [Text]: / .., ... - .: , 2007

6. . . [Text]: / .. , .. . - 3- ., . - .: , 2008. - 544 .: . - ISBN 978-5-06-004137-8: 633.93

7. , . /++ [Text] / . . - 2- ., . . - .: - , 2011. - 368 .: . . . (CD-ROM). - ISBN 978-5-94157-406-3: 233.26

8. .. . .( ) - : - , 2012.

9. .., .. . . . (, - ) - : - , 2008 60 .

10. .. . ( ) - : - , 2008.

 

:

1. . . []: / ... - 2- , . . - .: "", 2010. - 240 .: . - ISBN978-5-8199-0410-7: 175.01

2. , . . C++. [Text] / ... - C: , 2010. - 352 .: + 1 . . (CD-ROM). - ISBN 978-5-49807-102-2: 319.99

3. . . ++. [Text]: / .. , .. , .. ; . .. . - 2- ., . - .: -, 2000. - 344 .: . - ISBN 5-93517-014-0: 58.50, 69.30

 





:


: 2016-11-18; !; : 568 |


:

:

, , .
==> ...

2135 - | 1781 -


© 2015-2024 lektsii.org - -

: 0.033 .