文件in.txt内容
9-1 A+B的文本文件版 (10 分)
#include<stdio.h>
int main()
{
FILE *fp=fopen("in.txt","r");//定义in.txt文件指针
int a,b;
fscanf(fp,"%d %d",&a,&b);//读入in.txt文件数据
fp=fopen("out.txt","w");//指针指向out.txt文件
fprintf(fp,"%d",a+b);//将a+b结果写入out.txt文件中
fclose(fp);//关闭文件
}