main.cpp

来自「多项式运算」· C++ 代码 · 共 42 行

CPP
42 行
字号
#include <stdio.h>
#include <stdlib.h>

#include "slist.h"
#include "polynomial.h"

int main()
{
	list_t poly_1,poly_2,poly_sum,poly_dif;

	FILE *fInput, *fOutput;

	if ( (fInput=fopen("input.txt","r"))==NULL )
	{
		printf("Cannot Open the Input File.\n");
		return ERROR;
	}

	if ( (fOutput=fopen("022397.txt","w"))==NULL )
	{
		printf("Cannot Open the Output File.\n");
		return ERROR;
	}

	poly_1 = init_list();
	poly_2 = init_list();
	
	fill_list(fInput , poly_1);
	fill_list(fInput , poly_2);

	fclose(fInput);

	poly_sum = poly_add(poly_1 , poly_2);
	poly_dif = poly_mul(poly_1 , poly_2);

	out_data(fOutput , poly_sum);
	out_data(fOutput , poly_dif);

	fclose(fOutput);

	return 0;
}

⌨️ 快捷键说明

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