下列程序的输出结果是_________。 #include class point { public: point(int i,int j) {x=i;y=j;} void print() {cout<<'('< (5,7) (4,3) (9,10) (-5,-7) 10.61.5
举一反三
- 下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _
- 以下程序的运行结果是 _____ 。 #include int main() { int i=2,x=5,j=7; void fun(int i,int j); fun(j,6); printf("i=%d; j=%d; x=%d\n",i,j,x); return 0; } void fun(int i,int j) { int x=7; printf("i=%d; j=%d; x=%d\n",i,j,x); }
- 有以下程序: #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
- 下列程序执行的结果是()。public class A {public static void main(String[] args){int y = 0;int i = 6;for (int j = 1; j <; 6; j++){if (i % j == 0)y += j;}System.out.print(y);}} A: 3 B: 6 C: 9 D: 12
- 有如下程序: #include <iostream> using namespace std; class sample private: int x, y; public: sample(int i,int j) x=i; y=j; void disp() cout<<"displ"<<end1; void disp() const cout<<"disp2"<<end1; ; int main () const sample a(i,2); a.disp (); return 0; 该程序运行后的输出结果是( )。 A: disp1 B: disp2 C: disp1 disp2 D: 程序编译时出错