Guest User

Untitled

a guest
Jul 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. class progress
  4. {
  5. public:
  6. double a1;
  7. double d;
  8. virtual double summ(double n);
  9. };
  10.  
  11. class aprogress : public progress
  12. {
  13. public:
  14. double summ(double n)
  15. {
  16. double an = a1 + (n - 1) * d;
  17. return (n + 1) * (a1 * an) / 2;
  18. }
  19. };
  20.  
  21. class gprogress : public progress
  22. {
  23. public:
  24. double summ(double n)
  25. {
  26. double an = a1*d*n-1;
  27. return (a1-an*d)/(1-d);
  28. }
  29. };
  30.  
  31. int main()
  32. {
  33. return 0;
  34. }
Add Comment
Please, Sign In to add comment