Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- using namespace std;
- class Complex;
- class Pereche {
- friend class Complex;
- private:
- int a, b;
- public:
- Pereche(int aa, int bb) : a{ aa }, b{ bb } {
- }
- Pereche() {
- }
- };
- class Complex {
- friend class Pereche;
- Pereche m, n;
- public:
- Complex() {
- cin >> m.a >> m.b >> n.a >> n.b;
- }
- void afisare() {
- cout << m.a << "+ " << m.b << "i\n";
- cout << n.a << "+ " << n.b << "i\n";
- }
- void suma() {
- Pereche s;
- s.a = m.a + n.a;
- s.b = m.b + n.b;
- cout << s.a << "+ " << s.b << "i\n";
- }
- };
- int main() {
- Complex c;
- c.afisare();
- c.suma();
- cout << endl;
- cin.get();cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement