Last active
August 29, 2015 14:02
-
-
Save dd1994/73fcb0cc4ff60b83aaa6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #define MAX 100 | |
| using namespace std; | |
| int main(void) | |
| { | |
| int i, j, m, n; | |
| double a[MAX]; | |
| cout << "please input n: "; | |
| cin >> n; | |
| cout << "please input a[n], a[n-1]...,a[1],a[0](one space between them):" << endl; | |
| for (i = n; i >= 0; --i) | |
| { | |
| cin >> a[i]; | |
| } | |
| cout << "please input m(m <= n):"; | |
| cin >> m; | |
| for (i = n; i > m - 1; --i) | |
| { | |
| for (j = i; j > i - m; --j) | |
| { | |
| a[i] *= j; | |
| } | |
| } | |
| cout << "The answer:" << endl; | |
| for (i = n; i > m; --i) | |
| { | |
| cout << a[i] << 'x' << '^' << i - m << '+'; | |
| } | |
| cout << a[m] << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment