OOCP2_3

//BCA Support //www.bcasupport.xyz #include <iostream.h> #include <conio.h> class currency { int rupee,paisa; public: currency(){} currency(int r, int p) { rupee=r; paisa=p; } void display() { cout<<"\nCurrency = Rs. "<<rupee<<"."<<paisa; } friend currency AddCurrency(currency,currency); }; currency AddCurrency(currency,currency); int main() { clrscr(); currency c1(5,50); c1.display(); currency c2(94,49); c2.display(); currency c3=AddCurrency(c1,c2); c3.display(); getch(); return 0; } currency AddCurrency(currency a,currency b) { currency c; c.rupee=a.rupee+b.rupee; c.paisa=a.paisa+b.paisa; return c; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.