网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

( 17 )请阅读下面程序

public class OperatorsAndExpressions {

void residuals {

int i=100,j=30;

float m=563.5f,n=4.0f;

System.out.println ( i%j ) ;

System.out.println ( m%n ) ;

}

public static void main ( String args[] ){

OperatorsAndExpressions OperAndExp new OperatorsAndExpressions () ;

//取模运算符在整数和浮点数中的应用

OperAndExp.residual () ; }}

程序运行结果是

A ) 10

3.5

B ) 20

2.5

C ) 10

4.5

D ) 20

3.5


参考答案

更多 “ ( 17 )请阅读下面程序public class OperatorsAndExpressions {void residuals {int i=100,j=30;float m=563.5f,n=4.0f;System.out.println ( i%j ) ;System.out.println ( m%n ) ;}public static void main ( String args[] ){OperatorsAndExpressions OperAndExp new OperatorsAndExpressions () ;//取模运算符在整数和浮点数中的应用OperAndExp.residual () ; }}程序运行结果是A ) 103.5B ) 202.5C ) 104.5D ) 203.5 ” 相关考题
考题 阅读下面程序: include void main() { int i,j,row=0,column=0,m; static int a[3] 阅读下面程序:include <iostream.h>void main(){int i,j,row=0,column=0,m;static int a[3][3]={ 100,28,72,-30,2,-100};m=a[0][0];for (i=0;i<3;i++)for (j=0;j<3;j++)if (a[i][j]<m){m=a[i][j];row=i;column=j;}cout<<m<<","<<row<<","<<column<<endl;}该程序的功能是【 】,其执行结果为上丝【 】。

考题 请阅读下面程序 public class OperatorsAndExpressions { void residual() { int i=100, j=30; float m=563.5f, n=4.0f; System.out.println(i%j); System.out.println(m%n); } public static void main(String args[]) { OperatorsAndExpressions perAndExp=new OperatorsAndExpressions(); //取模运算符在整数和浮点数中的应用 OperAndExp.residual; } } 程序运行结果是A.10 3.5B.20 2.5C.10 4.5D.20 3.5

考题 阅读以下程序,此程序的功能是【】。 include void main() { intn, i, j; for(i=100;i 阅读以下程序,此程序的功能是【 】。include<iostream.h>void main(){int n, i, j;for(i=100;i<999; i+100)for(j=i/100:j<=99;j=j+10){n=i+j;cout<<" "<<n;}cout<<"\n";}

考题 对于下面程序,对p进行赋值正确的是( )。 class A{ public:fun(int i){cout<<i<<endl;} }; main(){ void(A::*p)(int); }A.p=fun;B.p=fun();C.p=A::fun;D.p=A::fun()

考题 下面程序段中的错误语句是 ______。 class M{ int i; public: void ~AA(int); AA *p; void AA(); void AA(int x){i=x;}; };A.AA *p;B.void ~AA(int);C.void AA(int);D.void AA(int x){i=x;};

考题 阅读下面程序:includevoid main(){int i,j,row=0,column=0,min;static int a[3][3] 阅读下面程序: #include<iostream.h> void main() { int i,j,row=0,column=0,min; static int a[3][3]={100,28,72,-30,2,-100}; min=a[0][0]; for(i=0;i<3;i++) for(j=0;j<3;j++) if(a[i][jl<min) { min=a[i][j]; row=i; column=j; } cout<<min<<","<<row<<","<<column<<endl; } 该程序的执行结果为( )。A.-100,2,3B.-100,1,2C.100,1,1D.100,0,0

考题 阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。 【说明】 以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。 【Java代码】 interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}

考题 阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。 【说明】 以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。 【C++代码】 #include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}

考题 下面程序的功能是输出以下形式的金字塔图案。请填空。(两个答案之间用1个空格隔开) * *** ***** ******* int main (void) { int i,j; for (i=1;i<=4;i++) { for (j =1; j<=4-i; j++) printf (“ “ ); for(j =1; j<=_____;j++) printf(“*”); _______________________;} return 0;}