12.07.2015 Views

C++ - VideoTutorials-bg.com

C++ - VideoTutorials-bg.com

C++ - VideoTutorials-bg.com

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Задача 83. Като се направи подходяща модификация на accumulate, дасе напише програма, която по дадени естествено число n и реално числоx, намира сумата:n∑i=0ixi!Програма Zad83.cpp решава задачата. В нея a и b са 0 и nсъответно. Термът f е:ixf: i ⎯⎯→,i!а стъпката се задава от:next : i ⎯⎯→i +1.Направена е модификация на функцията accumulate. Последната се налагазаради промяната на типовете на a, b, на f и next.// Program Zad83.cpp#include #include typedef double (*type1) (double, double);typedef double (*type2)(int);typedef int (*type3) (int);double x;double accumulate(type1, double, int, int, type2, type3);double f(int);int next(int);double sum(double, double);int main(){cout > n;if (!cin || n < 0){cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!