Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/pages/C%C3%B9ng-h%E1%BB%8Dc-l%E1%BA%ADp-tr%C3%ACnh/632038696941833
- #include <iostream>
- using namespace std;
- struct SoHang
- {
- int HeSo, SoMu;
- };
- void main()
- {
- int y = 0;
- int n, x;
- SoHang *SH;
- cout << "Nhap bac cua da thuc: ";
- cin >> n;
- n = n + 1;//bao gom so hang co so mu = 0
- SH = new SoHang[n];
- for (int i = 0; i < n; i++)
- {
- cout << "Hang tu bac " << i << endl;
- cout << "Nhap he so: ";
- cin >> SH[i].HeSo;
- cout << "Nhap so mu: ";
- cin >> SH[i].SoMu;
- }
- cout << "Nhap gia tri x = ";
- cin >> x;
- for (int i = 0; i < n; i++)
- {
- y = y + SH[i].HeSo * pow(x, SH[i].SoMu);
- }
- cout << "Gia tri da thuc tai x = " << x << " la: y = " << y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement