#include <iostream.h> #include <conio.h> class Banding { friend istream& operator>>(istream&, Banding&); public: Banding() {}; void bandingkan() { if (A > B) cout << "Bilangan terbesar : " << A; else cout << "Bilangan terbesar : " << B; } private: int A, B; }; istream& operator>>(istream& in, Banding& bilangan){ cout << "Bilangan pertama = "; in >> bilangan.A; cout << "Bilangan kedua = "; in >> bilangan.B; return in; }; main() { Banding bilangan; cin >> bilangan; bilangan.bandingkan(); getch(); return 0; }
0 Response for the "Program C++ memandingkan Bilangan Terbesar Dengan Operator Overloading"
Post a Comment