题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-04-10 01:23:35

[填空题]以下程序的功能是输出杨辉三角形前10行,请在下划线处填上正确的内容,使程序能正确运行。 #include #define N 11 main( ) {int i,j,a[N][N]; for(i=1;i

更多"以下程序的功能是输出杨辉三角形前10行,请在下划线处填上正确的内容,使"的相关试题:

[简答题]在下面程序中的下划线处填上适当的程序,使程序的输出结果如下:
x=2.y=3
源程序如下:
#include<iostream.h>
class Sample

int x,y;
public:
Sample( )x=y=0;
Sample(______)x=a;y=b;
void disp( )

cout<<"x="<<x<<",y="<<y<<endl;


void main( )

Sample s(2,3),______
p->disp( );

[简答题]在下面程序中的下划线处填上适当的语句,使程序的输出结果如下:
11,77
11,77
源程序如下:
#include<iostream>
using namespace std;
class base

private:
int x,y;
public:
void initxy(int a,int b)x=a;y=b;
void show( )
______

void main( )

base a,b;
a.show( );
b=a;
b.show( );

[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。 #include <stdio.h> main( ) { int n,s; printf("Enter a number:");scanf("%d",&n); printf("Output:"); do { s=n%10;printf("%d",s);______; }while(n! =0); printf("/n"); }
[简答题]在下面程序中的下划线处填上适当的程序,使程序的输出结果如下:
x=1,y=2
x=30,y=40
源程序如下:
#include<iostream.h>
class Sample

int x,y;
public:
Sample( )x=y=0;
Sample(int i,int j)x=i;y=j;
void copy(Sample& s);
void setxy(int i,int j)x=i;y=j;
void print( )cout<<"x="<<x<<",y="<<y<<endl;

void Sample::copy(______)

x=s.x;y=s.y;

void func(______)

s1.setxy(10,20);
s2.setxy(30,40);

void main( )

Sample p(1,2),q;
q.copy(p);
func(p,q);
p.print( );
q.print( );

[填空题]以下程序的功能是利用函数求100-200间素数(质数)的个数,请在下划线处填上正确的语句,使程序能正确运行。 #include int isprime(int n) { int i,f; f=1; for(i=2;i
[填空题]在下列程序的下划线处,填入适当语句使程序能正确执行并输出异常栈信息。 public class ThrowableException{ public static void main(String args[]{ try{ throw new Throwable(“这里是本人定义的异常”); }catch(Throwable e){ System.out.println("Caught Throwable"); System.out.println("e.getMessage( ): "+e.getMessage( )); System.out.println("e.toString( ):"+e.toString( )); System.out.println( "e.printStackTrace( ):"); 【 】;}}}
[填空题]在下列程序的下划线处,填入适当语句使程序能正确执行并输出异常栈信息。
public class Throwable Exception
public static voidmain(Stringargs[i]
try
thrownewThrowable("异常");
catch(Throwablee)
System.out.println("CaughtThrowable");
System.out.println("e.getMessage( ):"+e.getMessage( ));
System.out.println("e.toString( ):"+e.toString( ));
System.out.println("e.printStackTrace( ):");

[填空题]在下列程序的下划线处,填入适当语句,使程序能正确执行并输出异常栈信息。
public class ThrowableException
public static void main(String args[])
try
throw new Throwable("这里是本人定义的异常");
catch(Throwable e)
System.out.pfinfin("Caught Throwable");
System.out.println("e.getMessageO: "+e.getMessageO);
System.out.println("e.toString0: "+e.toStringO);
System.out.println("e.printStackTrace( ): ");
【11】 ;
[填空题]请在以下程序第一行的下划线处填写适当内容,使程序能正确运行。   【 】( double,double);   main( )   { double x,y;    scanf("%lf%lf",&x,&y);    printf("%lf/n",max(x,y));   }   double max(double a,double b)   { return(a>b a:b); }
[填空题]请在以下程序第一行的下划线处填写适当内容,使程序能正常运行。 #include <stdio.h> 【16】 (double,double); main( ) { double x,y; scanf("%If%If",&x,&y); printf("%If/n",max(x,y)); } double max(double a,double b) { return(a>b a:b);}
[填空题]以下程序运行后的输出结果是 【10】
#include <iostream>
#include <string>
using namespace std;
class Y;
class X

iht x;
char *strx;
public:
X(int a,char *str)

x=a;
strx=new char[strlen(str)+1];
strcpy(strx,str);

void show(Y &ob);
;
class Y

private:
iht y;
char *stry;
public:
Y(int b,char *str)

y=b;
stry=new char[strlen(str)+ 1] ;
strcpy(stry, str);

friend void X::show(Y &ob);
;
void X::show(Y &ob)

cout<<strx<<",";
cout<<ob.stry<<endl;

int main( )

X a(10,"stringX");
Y b(20,"stringY");
a.show(b);
return 0;

[填空题]以下程序运行后的输出结果是 【14】 。 #include <iostream> #include <string> using namespace std; class Y; class X { int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+l]; strcpy(strx,str); } void show(Y &ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+l]; strcpy(stry, str); } friend void X::show(Y &ob) ; }; void X::show(Y &ob) { cout<<strx<<","; cout<<ob.stry<<end1; } int main( ) { X a(10,"stringX"); Y b(20,"stringY"); a. show (B) ; return 0; }
[填空题]请在以下程序第一行的下划线处填写适当内容,使程序能正确运行。
【16】 (double,double);
main( )
double x,y;
scanf("%1f%1f",&x,&y);
printf("%1f/n",max(x,y));

double max(double a,double b)
return(a>b a:b);

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码