Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double polynom(unsigned, double);
- int main(void)
- {
- cout << polynom(2, 3) << endl;
- return 0;
- }
- double polynom(unsigned n, double x)
- {
- double currentAdd(x);
- double res(0);
- while (n)
- {
- res += currentAdd;
- currentAdd *= currentAdd;
- --n;
- }
- return res;
- }
- using namespace std;
- double polynom(unsigned, double);
- polynom(-1, 2); // Compiler is happy to convert that -1 to a very large
- // positive number without an y errors. On the reciving
- // side you can not tell if it was an error.
- int main(void)
- {
- return 0;
- }
- double currentAdd(x);
- double res(0);
- double currentAdd = x;
- double res = 0;
- while (n)
- {
- --n;
- }
- // over
- for(;n; --n)
- {
- }
Add Comment
Please, Sign In to add comment