Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Te shkruhet kodi qe llogarite y=n+a-b
- // n dhe a jane variabla private te klases Alfa , b eshte variabel publike dhe jepet ne main permes tastieres
- //Vlerat i inicializoni si te odni dhe per llogaritje perdorni funksionin llogaritja();
- #include <iostream>
- #include <string>
- using namespace std;
- class Alfa
- {
- private:
- int a , n;
- public:
- int b;
- Alfa(int A , int N)
- {
- a=A;
- n=N;
- }
- int llogaritja()
- {
- return n+a-b;
- }
- };
- int main()
- {
- Alfa a1(2,5);
- a1.llogaritja();
- cout<<"Jep vleren e B: ";
- cin>>a1.b;
- cout<<"Vlera e funksionit y=n+a-b eshte : " <<a1.llogaritja()<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement