下列程序对加号进行了重载,划线部分的语句是______。 include include class 下列程序对加号进行了重载,划线部分的语句是______。include<iostream.h>include<math.h>class Triangle{int x,y,z;double area;public:Triangle(int i,int j,int k){double s;x=i;y=j;z=k;s=(x+y+z)/2.0;area=sqrt(s*(s-x)*(s-y)*(s-z));}void disparea( ){cout<<"Area="<<area<<endl;}friend double operator+(Triangle tl,Triangle t2){______}};void main( ){Triangle tl(3,4,5),t2(5,12,13);double s;cout<<"tl:";t1. disparea( );cout<<"t2:";t2. disparea( );s=t1+t2:cout<<"总面积:="<<s<<endl;}

下列程序对加号进行了重载,划线部分的语句是______。 include include class

下列程序对加号进行了重载,划线部分的语句是______。

include<iostream.h>

include<math.h>

class Triangle

{

int x,y,z;

double area;

public:

Triangle(int i,int j,int k)

{

double s;

x=i;y=j;z=k;

s=(x+y+z)/2.0;

area=sqrt(s*(s-x)*(s-y)*(s-z));

}

void disparea( )

{

cout<<"Area="<<area<<endl;

}

friend double operator+(Triangle tl,Triangle t2)

{

______

}

};

void main( )

{

Triangle tl(3,4,5),t2(5,12,13);

double s;

cout<<"tl:";t1. disparea( );

cout<<"t2:";t2. disparea( );

s=t1+t2:

cout<<"总面积:="<<s<<endl;

}


相关考题:

下列程序完成从文件读取文件显示的同时写入第二个文件,则在程序中划线部分应该出现的语句是______。include<iostream.h>include(fstream.h)void main(){fstream filel,file2;charfnl[10],fn2[10],ch;cout<<“输入源文件名”;cin>>fnl;cout<<“输入目标文件名”;cin>>fn2;filel.open(fnl,ios::i

下列程序不能通过编译,应该在划线部分填写的语句是【 】。includeinclude 下列程序不能通过编译,应该在划线部分填写的语句是【 】。include<iostream. h>include<stdlib. hdouble Fune(int a, int b, char ch){double x;switch(ch){case '+':x=double(a) +b;break;case '--':x= double(a) --b;break;case '/':x=double(a) * b;break;case '/':if(B) x=double(a) /b;elseexit(1)breakdefault:exit(1);}______}void main(){cout<<Func(32 , 6 ,'--')<< ",";cout<<Func(32, 6 ,'*') <<",";cout<<Func(32, 6 ,'/') <<end1;}

下列程序不能通过编译,应该在划线部分填写的语句是______。 include include 下列程序不能通过编译,应该在划线部分填写的语句是______。include<iostream.h>include<stdlib.h>double Func(int a,int b,char ch){double x;switch(ch){case'+':x=double(a)+b;break;case '-':x=double(a)-b;break;case '*':x=double(a)*b;break;case'/':if(B)x=double(a)/b;elseexit(1);break;default:exit(1);}______}void main( ){cout<<Func(32,6,'-')<<",";cout<<Func(32,6, '*')<<",";cout<<Func(32,6,'/')<<endl;}

在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是A.#include <math.h>B.#include <stdio.h>C.#define <math.h>D.#define <stdio.h>

在C程序中如果要使用数学函数,如sqrt(x),pow(x,y)等,需要在程序中加入的语句是______A.#define <math.h>B.#define <stdio.h>C.#include <stdio.h>D.#include <math.h>

16、在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是A.#include <math.h>B.#include <stdio.h>C.#define <math.h>D.#define <stdio.h>

2、在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是A.#include <math.h>B.#include <stdio.h>C.#define <math.h>D.#define <stdio.h>

在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是()A.#include <stdio.h>B.#define <stdio.h>C.#include <math.h>D.#define <math.h>

在C程序中如果要使用数学函数,如sin(x),log(x)等,需要在程序中加入的语句是________。A.#include <math.h>B.#include <stdio.h>C.#define <math.h>D.#define <stdio.h>