(35 )有如下程序::#includeusing namespace std:class Sample{friend long fun (Sample s ) ;p
(35 )有如下程序::
#include
using namespace std:
class Sample
{
friend long fun (Sample s ) ;
public:
Sample (long a ) {x=a;}
Private:
long x;
};
long fun (Sample s )
{
if (s.x<2 ) retum 1;
retum s.x*fun (Sample (s.x-a ))
}
int main ()
{
int sum=0
for (int i =0; i <6; i ++ ) { sum+=fun (Sample (i ) ; ) }
cout<<SUM;
retum 0;
}
运行时输出的结果是
A ) 120
B ) 16
C ) 154
D ) 34