Odpowiedzi

2009-11-30T12:37:37+01:00
#include <iostream>

int main()
{
int n;
std::cout << "n = ";
std::cin >> n;
float* a = new float[n];
for (int i = 0; i < n; i++)
{
std::cout << "a[" << i << "] = ";
std::cin >> a[i];
}
std::cout << "x = ";
int x;
std::cin >> x;

float result = 0;
int xpower = 1;
for (int i = n-2; i >= 0; i--)
{
result += a[i] * x * xpower;
xpower *= x;
}
result += a[n-1];
std::cout << "WYNIK: " << result;
}
1 2 1