1、设计一个程序,其中有3个类,即CBank,BBank和GBank,分别为中国银行类、工商银行类和农业银行类。每个类都包含一个私有数据balance,用于存放...
代码说明:
1、设计一个程序,其中有3个类,即CBank,BBank和GBank,分别为中国银行类、工商银行类和农业银行类。每个类都包含一个私有数据balance,用于存放储户在该行的存款数,另有一个友元函数total用于计算储户在这3家银行中的总存款数。 2、设计一个程序,其中有2个类,Point类为点类,包含2个私有数据x和y,表示点的坐标,line类为直线类,包含3个私有数据a,b和c,表示直线方程ax+by+c=0。另有一个友元函数dist,用于计算一个点到直线的距离。点与直线之间的距离计算公式如下:(提示:本题为有元函数的应用) -1, design a program, of which three categories, namely CBank, BBank and GBank, respectively, for the Chinese banking, business banking and agricultural banking. Each class contains a private data balance, used to store the bank deposits of savers in the number, while a friend function used to calculate the total depositors in the three the number of total deposits in banks. 2, design a program, of which there are 2 categories, Point class for the point class, including two individual and private data are x and y, that the coordinates of points, line for line class categories, with three individual and private data are a, b and c, that straight line equation ax+ by+ c = 0. There is also a friend function dist, used
下载说明:请别用迅雷下载,失败请重下,重下不扣分!