Pat(Advanced Level)Practice--1002(A+B For Polynomials)

Pat1002 代码

#include

#define N 1001

int main(int argc,char *argv[])
{
	int exp1[N],exp2[N],exp3[N];
	float coef1[N],coef2[N],coef3[N];
	int K1=0,K2=0,K3=0;
	int i,j;
	scanf("%d",&K1);
	for(i=0;i
还有一种简单方法,如下:
#include 
const int N=1000;
void Polynomials()
{
	float ar1[N+1],ar2[N+1],f;
	int k,i,index;
	for(i=0;i<=N;i++) {ar1[i]=0;ar2[i]=0;}
	scanf("%d",&k);
	for(i=0;i=0;i--)
	{
		if(ar1[i]!=0) printf(" %d %.1f",i,ar1[i]);
	}
 }


int main()
{
	Polynomials();
	return 0;
}

你可能感兴趣的:(Advance,Pat,C++,Pat,STL,算法,编程)