标签:小代码
class abank; class bbank; class cbank { int balance; public: cbank(){balance=0;} cbank(int b){balance=b;} void getbalance(){int add;cin>>add;balance=balance+add;} void dis(){cout<<balance<<endl;} friend void total(abank,bbank,cbank); }; class bbank { int balance; public: bbank(){balance=0;} bbank(int b){balance=b;} void getbalance(){int add;cin>>add;balance=balance+add;} void dis(){cout<<balance<<endl;} friend void total(abank,bbank,cbank); }; class abank { int balance; public: abank(){balance=0;} abank(int b){balance=b;} void getbalance(){int add;cin>>add;balance=balance+add;} void dis(){cout<<balance<<endl;} friend void total(abank,bbank,cbank); }; void total(abank a,bbank b,cbank c) { cout<<"all money is:"<<a.balance+b.balance+c.balance<<endl; } int main() { cbank c(100); bbank b; abank a; a.dis(); b.dis(); c.dis(); a.getbalance(); b.getbalance(); c.getbalance(); a.dis(); b.dis(); c.dis(); total(a,b,c); return 0; }
标签:小代码
原文地址:http://wzsts.blog.51cto.com/10251779/1761560