Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class alfa
- {
- private:
- int a,b,c,n,x;
- public:
- alfa()
- {
- }
- alfa(int a_,int b_,int c_,int x_, int n_)//Konstruktori per incializim te vlerave
- {
- a=a_;
- b=b_;
- c=c_;
- x=x_;
- n=n_;
- }
- //Deklarim i funkcioneve
- int min(int a1,int b1,int c1);
- int faktoriel(int n);
- };
- //Definim i funkcioneve
- int alfa::min(int a,int b,int c)
- {
- if(a<b && a<c) return a;
- else if(b<a && b<c) return b;
- else return c;
- }
- int alfa::faktoriel(int n)
- {
- int fakt=1;
- for(int i=1;i<=n;i++)
- {
- fakt*=i;
- }
- return fakt;
- }
- int main()
- {
- float g;
- int a,b,c,n,x;
- cout<<"x = ";
- cin>>x;
- cout<<"n = ";
- cin>>n;
- cout <<"a = ";
- cin>>a;
- cout <<"b = ";
- cin>>b;
- cout <<"c = ";
- cin>>c;
- alfa a1(a,b,c,x,n);
- g = ((3*x)/(float)a1.faktoriel(2))-(a1.faktoriel(n+1))+(3*a1.min(a,b,c));
- cout << "g = "<<g;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement