Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Second question in OOP Labs ( B )
- #include"iostream"
- #include"string"
- using namespace std;
- class secondClass;
- class firstClass
- {
- private:
- int a[4];
- public:
- void set()
- {
- int i;
- for (i = 0; i < 4; i++)
- {
- cout << "Enter Data : ";
- cin >> a[i];
- }
- }
- friend void check(firstClass, secondClass);
- };
- class secondClass
- {
- private:
- int x;
- public:
- void set()
- {
- cout << "Enter Number : "; cin >> x;
- }
- friend void check(firstClass, secondClass);
- };
- void check(firstClass f, secondClass s)
- {
- if (s.x == 1)
- f.a[4] += 10;
- else if (s.x == 0)
- f.a[4] -= 10;
- }
- int main()
- {
- firstClass f;
- secondClass s;
- f.set();
- s.set();
- check(f, s);
- }
Advertisement
Add Comment
Please, Sign In to add comment