AKSH Cpp Assignemnt
AKSH Cpp Assignemnt
01fe22bar048
#include <iostream>
class Complex {
private:
double real;
double img;
public:
void display() {
if (img < 0)
cout << real << " - " << -img << "i";
else
cout << real << " + " << img << "i";
};
int main() {
);
myComplex1.display();
myComplex2.display();
result.display();
return 0;
//OUTPUT
//code to find total balance from current and savings account using friend class
#include <iostream>
class SavingsAccount;
class CurrentAccount;
class SavingsAccount {
private:
float balance;
public:
};
class CurrentAccount {
private:
float balance;
public:
};
cout << "Total Balance in both accounts: " << totalBalance << endl;
int main() {
SavingsAccount savings(1000.50);
CurrentAccount current(2500.75);
printTotalBalance(savings, current);
return 0;
}
//OUTPUT