t11.c

来自「c语言小程序100个」· C语言 代码 · 共 40 行

C
40
字号
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#define  N 81
void readwriteDAT();

void chg(char*s) 
{
}

main( )
{
 char a[N];
 clrscr();
 printf("Enter a string : "); gets(a);
 printf("The original string is : "); puts(a);
 chg(a);
 printf("The string after modified : ");
 puts (a);
 readwriteDAT() ;
 system("pause");
}

void readwriteDAT()
{
 int i ;
 char a[N] ;
 FILE *rf, *wf ;

 rf = fopen("in.dat", "r") ;
 wf = fopen("out.dat", "w") ;
 for(i = 0 ; i < 10 ; i++) {
   fscanf(rf, "%s", a) ;
   chg(a) ;
   fprintf(wf, "%s\n", a) ;
 }
 fclose(rf) ;
 fclose(wf) ;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?