lbsf.cpp

来自「中过科学技术大学历年复试机试题」· C++ 代码 · 共 29 行

CPP
29
字号
#include<stdio.h>
#include<stdlib.h>
#include<string>

void main(){
  FILE *fp,*fpp;

  if((fp=fopen("d:\\yt\\input3.txt","r"))==NULL){
      printf("file open error!\n");
	  exit(0);
  }
  
  if((fpp=fopen("d:\\yt\\output3.txt","w"))==NULL){
      printf("file open error!\n");
	  exit(1);
  }
  
  
  char str[128];
  int n=0;
  while(!feof(fp)){
      fscanf(fp,"%[^\n]",str);
	  n=strlen(str);
	  printf("%s",str);
      fseek(fp,n,1);
  }
  fclose(fp);
  fclose(fpp);
}

⌨️ 快捷键说明

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