Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. #include "stdafx.h"
  3. #include <iostream>
  4. #include <string>
  5. using namespace std;
  6.  
  7. class Hello
  8. {
  9. public:
  10. int x, n, a;
  11.  
  12. int Kalkulimi()
  13. {
  14. int S = 0;
  15.  
  16. for (int i = 1; i <= n + 1; i++)
  17. {
  18. S = S + (2 * i + a);
  19. }
  20. return 3 * x + 4 * S;
  21. }
  22. };
  23.  
  24.  
  25.  
  26. int main()
  27. {
  28. Hello beta;
  29. beta.x = 2;
  30. beta.n = 3;
  31. beta.a = 4;
  32. beta.Kalkulimi();
  33.  
  34. cout << "Vlera e funksionit eshte : " << beta.Kalkulimi() << endl;
  35.  
  36.  
  37. cin.get();
  38. cin.get();
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement