有以下程序:includeincludeusingnamespacestd;classDistance;classpoint{pub 有以下程序: #include <iostream> #include <cmath> using namespace std; class Distance; class point { public: friend class Distance; Point(int a,int B) { x=a; Y=b; } void Print() { cout<<"X= "<<X<<end1; cout<<"Y= "<<Y<<end1; } private: float X,Y; }; class Distance { public: float Dis(Point p,Point q); }; float Distance :: Dis(Point p,Point q) { float result; result=sqrt((p.X-q.X)*(p.X-q.X)+(p.Y-q.Y)*(p.Y-q.Y)); cout<<result<<end1; retUrn result; } int main() { Point p(10,10),q(10,30); Distance d; d.Dis(p,q); return 0; } 运行后的输出结果是( )。A.10B.30C.0D.20

有以下程序:includeincludeusingnamespacestd;classDistance;classpoint{pub

有以下程序: #include <iostream> #include <cmath> using namespace std; class Distance; class point { public: friend class Distance; Point(int a,int B) { x=a; Y=b; } void Print() { cout<<"X= "<<X<<end1; cout<<"Y= "<<Y<<end1; } private: float X,Y; }; class Distance { public: float Dis(Point &p,Point &q); }; float Distance :: Dis(Point &p,Point &q) { float result; result=sqrt((p.X-q.X)*(p.X-q.X)+(p.Y-q.Y)*(p.Y-q.Y)); cout<<result<<end1; retUrn result; } int main() { Point p(10,10),q(10,30); Distance d; d.Dis(p,q); return 0; } 运行后的输出结果是( )。

A.10

B.30

C.0

D.20


相关考题:

下面程序的输出结果为______ include void main() {cout 下面程序的输出结果为______include<iostream.h>void main(){cout<<"Hello\b";}

以下程序的输出结果是【】。 include void main( ) } int a=0; a+=(a=8); cout 以下程序的输出结果是【 】。include<iostream.h>void main( )}int a=0;a+=(a=8) ;cout<<a;}

下面程序的执行结果是______。 include include using namespace std; vo 下面程序的执行结果是______。include<iostream.h>include<iomanip.h>using namespace std;void main(){cout<<setfill('x')<<setw(10);cout<<"Hello"<<endl;}

有以下程序: include include usingnamespacestd; intmain() {intarrays 有以下程序: #include <iostream> #include <cstdlib> using namespace std; int main() { int arraysize; int *array; cout<<"Please input the size of the array:"; cin>>arraySiZe; array=new int[arraysize]; if(array==NULL) { cout<<"allocate Error\n"; exit(1); } for(int i=0;i<arraysize;i++) array[i]=i*i; int j; cout<<"which element you want to check:"; cin>>j; cout<<array[j]<<end1; return 0; } 执行程序输入:10<空格>5,则输出结果为( )。A.allocate ErrorB.1C.0D.25

以下程序的执行结果是【】。 include include void pnnt(int n) { if (n!=0 以下程序的执行结果是【 】。include<iostream.h>include<iomanip.h>void pnnt(int n){if (n!=0){Print(n-1);for (int i=1;i<=n;i++)cout<<setw(3)<<i;cout<<endl;}}void main(){print(4);}

以下程序的输出结果 ______。 include void main() { int a=0; a+ =(a=8); cout 以下程序的输出结果 ______。include<iostream.h>void main(){int a=0;a+ =(a=8);cout<<a;}

有以下程序:include”iostream.h”void main(){int i=10;int j=5;cout((j+i++<<endl;}的结果为______。

有以下程序: include using namespace std; int main() {int i=010,j=10;cout 有以下程序:include <iostream>using namespace std;int main(){int i=010,j=10;cout<<(++i)<<","<<i--<<end1;return 0;}则该程序运行后的输出结果是【 】。

以下程序的输出结果是【】。 include include void main 0 { char s[50]; st 以下程序的输出结果是【 】。include<iostream.h>include <string.h>void main 0 {char s[50];strcpy(s[O], "No" );strcpy(s[1], "123" );strcpy (s[2], "23456" );cout<<s;}

有以下程序: include usingnamespacestd; classCFactorial { private:intvalue;intfac 有以下程序:include <iostream>using namespace std;class CFactorial{private:int value;int fact;public:CFactorial ( int val );void CalculateFactorial();void Display();};CFactorial :: CFactorial( int val ){value = val;fact = 1;}void CFactorial :: CalculateFactorial(){int i = value;while ( i > 1 )fact *= i--;}void CFactorial :: Display(){cout<<value<<"!="<<fact<<end1;}int main(){CFactorial A( 5 );A.CalculateFactorial();A.Display();return 0;}程序中,类CPactorial的功能是【 】,该程序运行的结果是【 】。

下面程序的执行结果是【】。 include include using namespace std; void main( 下面程序的执行结果是【 】。include<iostream>include<iomanip>using namespace std;void main(){cout<<setfill('x')<<setw(10);cout<<"Hello"<<endl;}

有以下程序:include using namespace std; class Base { public: Base() { K=0; } int 有以下程序:include<iostream>using namespace std;class Base{public:Base(){K=0;}int x;};class Derivedl:virtual public Base{public:Derivedl(){x=10;}};class Derived2:virtua1 public Base

有以下程序includeincludevoid main( ){char*p="abcde\0fghjik\0"; cou 有以下程序 #include<string.h> #include<iostream.h> void main( ) { char*p="abcde\0fghjik\0"; cout<<strlen(p);} 程序运行后的输出结果是A.12B.15C.6D.5

有以下程序: include usingnamespacestd; intmain() { intnum[2][3],*p; intt,i,j,k= 有以下程序: #include <iostream> using namespace std; int main() { int num[2][3],*p; int t,i,j,k=10; p=num[0]; for(i=0;i<2;i++) { for(j=0;j<3;j++) { k++; *p=k; for(t=2;t<*p;t++) { if(!(*p%t)) { j--; *p--; break; } *p++; } } cout<<*(p-1)<<end1; return 0; } 程序运行后的输出结果是( )。A.19B.11C.29D.23

以下程序的执行结果是【】。 include include include int ma 以下程序的执行结果是【 】。include <iostream.h>include <fstream.h>include <stdlib.h>int main(){fstream outfile, infile;outfile.open("D:\\text.dat",ios::out);if(!outfile){cout<<"text.dat can't open"<<end1

有以下程序:includeusingnamespacestd;definePI3.14classPoint{private: intx,y;pub 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a,int b,int c):Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<cl.area()<<endl; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

如有以下程序: #include(iostream usingnamespacestd; longfun(intn) { if(n)2) return(fun(n-1)+fun(n-2)); else return2; } intmain( ) { coutfun(3)endl; return0; } 则该程序的输出结果应该是( )。A.2B.3C.4D.5

有以下程序:include include using namespace std;class base{private: cha 有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {A.DerivedBaseB.BaseBaseC.DerivedDerivedD.BaseDerived

有以下程序:include include using namespace std;int main ( ){ ofstream 有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);A.程序编译时出错B.abc#C.abcD.#

有下列程序:includeusing namespace std;class ONE{ public:virtual void f(){COUt 有下列程序:include<iostream>using namespace std;class ONE{public:virtual void f(){COUt<<"1";}};c1assTWO:public ONE{public:TWO(){cout<<"2";}};class THREE:public TWO{pub

以下程序的运行结果是【】。 include include using namespace std; void main() 以下程序的运行结果是【 】。include<iostream>include<string>using namespace std;void main(){chara[10]="China",b[]="Chin",c[]="ese";cout<<strlen(strcat(strcpy(a,b),c))<<endl;}

有以下程序: #include(iostream) usingnamespacestd; intmain( ) { intx=15: while(x10&&x50) { x++; if(x/3) { x++;break; }} coutxendl; return0; } 执行后的输出结果是( )。A.15B.16C.17D.18

有以下程序: include include using namespace std; int main() {char arr[ 有以下程序: #include<iostream> #include<string> using namespace std; int main() { char arr[2][4]; strcpy(arr[0],"you"); strcpy(arr[1],"me"); arr[0][3]=''; cout<<arr[0]<<end1; return 0; } 执行后的输出结果是( )。A.youmeB.youC.meD.err

有以下程序:includeusing namespace std;Class A{public:A(){tout{("A"}};classB{pub 有以下程序: #include<iostream> using namespace std; Class A{ public: A(){tout{("A"} }; classB{public:B(){cout<<"B";>> classC:public A{ B b; public: C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )。A.CBAB.BACC.ACBD.ABC

有以下程序:include include using namespace std;int main ( ){ char b1[8 有以下程序: #include <iostream> #include <string> using namespace std; int main ( ) { char b1[8] = "abcdefg"; char b2[8],*pb=b1+3; while (--pb>=b1) strcpy (b2, Pb) ; cout<<strlen (b2) <<end1; return 0; } 程序运行后的输出结果是( )。A.8B.3C.1D.7

有以下程序:include include void main(){double d= 123.456789;cout 有以下程序:#include <iostream.h>#include void main(){ double d= 123.456789; cout<<setprecision(3)<<d<<","; cout<<setprecision(4)<<d<<","; cout<<setprecision(5 )<<d<<end1;}程序执行后的输出结果是( )。A.123,123.4,123.45B.123,123.5,123.46C.123,123,123.4D.123.456789,123.456789,123.456789

下列程序的输出结果是 include usingnamespacestd; int main () {chara []="Hello,W 下列程序的输出结果是 #include <iostream> using namespace std; int main () { char a [] = "Hello,World": char*ptr = a; while (*ptr) { if(*ptr>= 'a' *ptr <='z' cout<<char{*ptr+'A'-'a'); else cout<<*ptr; ptr++; } return 0; }A. HELLO. WORLDB. Hello, WorldC. hELLO, wORLDD. hello, world