pex10_6.cpp

来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 32 行

CPP
32
字号
#include <iostream.h>
#pragma hdrstop

// include solution to the committee problem
#include "comm.h"

void main(void)
{
	int n,i;
	
	// read the degree of the polynomial
	cout << "Enter n: ";
	cin >> n;
	
	// print the polymomial from highest to lowest
	// powers of x
	for(i=n;i >= 0;i--)
	{
		cout << comm(n,i) << "x**" << i;
		if (i != 0)
			cout << " + ";
	}
	cout << endl;
}

/*
<Run>

Enter n: 8
1x**8 + 8x**7 + 28x**6 + 56x**5 + 70x**4 + 56x**3 + 28x**2 + 8x**1 + 1x**0
*/

⌨️ 快捷键说明

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