题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-06-26 01:06:03

[单项选择]阅读以下程序以及对程序功能的描述,其中正确的描述是( )。
#include <stdio.h>
main( )
FILE * in,*out;
charch,infile[10],outfile[10];
printf("Enter the infile name:/n");
scanf("%s",infile);
printf("Enter the outfile name:/n");
scanf("%s",outfile);
if((in=fopen(infile,"r"))==NULL)
printf("cannot open infile/n");exit(0);
if((out=fopen(outfile,"w"))==NULL)
printf("cannot open outfile/n");exit(0);
while(! feof(in)) fputc(fgetc(in),out);
fclose(in);
fclose(out);

A. 程序完成将磁盘文件的信息在屏幕上显示的功能
B. 程序完成将两个磁盘文件合二为一的功能
C. 程序完成将一个磁盘文件复制到另一个磁盘文件中的功能
D. 程序完成将两个磁盘文件合并并在屏幕上输出的功能

更多"阅读以下程序以及对程序功能的描述,其中正确的描述是( )。 #in"的相关试题:

[单项选择]阅读以下程序以及对程序功能的描述,其中正确的描述是( )。 #include <stdio.h> main( ) { FILE * in,*out; charch,infile[10],outfile[10]; printf("Enter the infile name:/n"); scanf("%s",infile); printf("Enter the outfile name:/n"); scanf("%s",outfile); if((in=fopen(infile,"r"))==NULL) { printf("cannot open infile/n");exit(0);} if((out=fopen(outfile,"w"))==NULL) { printf("cannot open outfile/n");exit(0); } while(! feof(in)) fputc(fgetc(in),out); fclose(in); fclose(out); }
A. 程序完成将磁盘文件的信息在屏幕上显示的功能
B. 程序完成将两个磁盘文件合二为一的功能
C. 程序完成将一个磁盘文件复制到另一个磁盘文件中的功能
D. 程序完成将两个磁盘文件合并并在屏幕上输出的功能
[单项选择]阅读以下程序及对程序功能的描述,其中正确的描述是
#include<stdio.h>
main( )
FILE*in,*out;
char ch,infile[10],outfile[10];
printf("Enter the infile name:/n");
scanf("%s",infile);
printf("Enter the outfile name:/n");
scanf("%s",outfile);
if((in=fopen(infile,"r"))==NULL)
printf("cannot open infile/n");
exit(0);
if((out=fopen(outfile,"w"))==NULL)
printf("cannot open outfile/n");
exit(0);
while(!feof(in))fputc(fgetc(in),out);
fclose(in);
fclose(out);
A. 程序完成将磁盘文件的信息在屏幕上显示的功能
B. 程序完成将两个磁盘文件合二为一的功能
C. 程序完成将一个磁盘文件复制到另一个磁盘文件中
D. 程序完成将两个磁盘文件合并并在屏幕上输出
[单项选择]阅读以下程序及对程序功能的描述,其中正确的是 #include<stdio.h> main( ) { FILE*in,*out; charch,infile[10],outfile[10]; printf("Enter the infile name:/n"); scanf("%s",infile); printf("Enter the outfile name:/n"); scanf("%s",outfile); if((in=foen(infile,"r"))==NULL) { printf("cannot open infile/n"); exit(0);} if((out=fopen(outfile,"w"))==NULL) { printf("cannot open outfile/n"); exit(0);} while(!feof(in))fputc(fgetc(in),out); fclose(in);fclose(out);}
A. 程序完成将磁盘文件的信息在屏幕上显示的功能
B. 程序完成将两个磁盘文件合二为一的功能
C. 程序完成将一个磁盘文件复制到另一个磁盘文件中
D. 程序完成将两个磁盘文件合并并在屏幕上输出
[简答题]阅读以下程序代码,写出程序的功能。
public class Class34

public static void main(String[] args)

int a=1,b;
while(a<=9)

b=1;
while(b<=a)

System. out. print(" "+a+"×"+b+"="+a*b);
b++;

System. out. println( );
a++;



[简答题]
以下是某C程序段及其功能描述,请仔细阅读程序并完成要求
企业发放的奖金根据利润提成,发放规则如下:
利润(Ⅰ)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成。从键盘输入当月利润Ⅰ,输入应发放奖金总数。
#include
#include
int main( )
{
long int gain;
int prizel, prize2, prize4, prize6, prize10,prize=0;
puts("************************************");
puts("* The program will solve *");
puts(" * the problem of prize distribution * "):
puts(" ************************************");
puts("please input the mum of gain:");
scanf("%ld", &gain);
prizel=100000*0.1:
prize2=prizel+i00000*0.075:
prize4=prize2+200000*0.05:
prize6=prize4+200000*0.03:
prize10=prize6+400000*0.015:
if(gain<=100000)
prize=gain*0.1:
else if(gain<=200000)
prize=prizel+(gain-i00000)*0.075;
else if(gain<=400000)
prize
[填空题]阅读以下程序,此程序的功能是 [8] 。 #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"; }
[填空题]阅读以下程序,此程序的功能是 [8]
#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";

[填空题]阅读以下说明和Java程序,将应填入 (n) 处的字句写在对应栏内
[说明]
以下程序的功能时三角形、矩形和正方形的面积输出。
程序由5个类组成:areatest是主类,类Triangle,Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。
[Java程序]
public class areatest {
public static viod main(string args[]){
Figure[]Figures={
New triangle(2,3,3),new rectangle(5,8),new square(5)
};
for(int i=0; i<Figures.length;i++){
system.out.println(Figures+"area="+Figures.getarea( ));
}
}
}
public abstract class figure {
public abstract double getarea( );
}
public class rectangle extends (1) {
double height;
double width;
public rectangle (double height,double width){
this.height=height;
this.width=width;
}
public string tostring( ){
return"rectangle:height="+height+",width="+width+":";
}
public double getarea( ){
return (2)
}
}
public class square exends (3)
{
public square(double width
[填空题]阅读以下说明和C++程序,将应填入 (n) 处的字句写在对应栏内
[说明]
以下程序的功能是计算三角形、矩形和正方形的面积并输出。
程序由4个类组成:类Triangle,Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea( ),作为计算上述三种图形面积的通用接口。
[C++程序]
#include<iostream.h>
#include<math.h>
class Figure{
public:
virtual double getArea( )=0; //纯虚拟函数
};
class Rectangle: (1) {
protected:
double height;
double width;
public:
Rectangle( ){};
Rectangle(double height,double width){
This->height=height;
This->width=width;
}
double getarea( ){
return (2) ;
}
};
class Square: (3)
public:
square(double width){
(4) ;
}
};
class triangle: (5) {
double la;
double lb;
double lc;
public:
triangle(double la,double lb,double lc){
this->la=la;thiS->ib;this->lc;
}
double getArea( ){
double s=(la+lb+lc)/2.0;
return sqrt(s*(s-la)
[简答题]
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
【说明】
以下程序的功能是计算三角形、矩形和正方形的周长并输出。
程序由4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类 Figure提供了一个纯虚拟函数getGirth( ),作为计算上述3种图形周长的通用接口。
【C++程序】
# include < iostream. h >
# include < math. h >
class Figure {
public:
virtual double getGirth( ) =0; //纯虚拟函数 };
class Rectangle: (1) {
protected:
double height;
double width;
public:
Rectangle( ){};
Rectangle( double height, double width) {
this→height = height;
this→width = width;
}
double getGirth ( ) {
return (2) ;
}
};
class Square: (3) {
public:
Square( double width) {
(4) ;
} };
class Triangle: (5) {
double la;
double lb;
double lc;
public:
Triangle( double la,double lb,double lc){
this→la = la; this→Lb = lb; this→lc = lc;
}
double ge
[填空题]
阅读以下说明和C程序代码,将程序补充完整。
[说明]
下面C程序代码的功能是:对于输入的一个正整数n(100≤n<1000),先判断其是否是回文数(正读反读都一样的数)。若不是,则将n与其反序数相加,再判断得到的和数是否为回文数,若还不是,再将该和数与其反序数相加并进行判断,依此类推,直到得到一个回文数为止。例如,278不是回文数,其反序数为872,相加后得到的1150还不是回文数,再将1150与其反序数511相加,得到的1661是回文数。
函数int isPalm(long m)的功能是:将正整数m的各位数字取出存入数组中,然后判断其是否为回文数。若m是回文数则返回1,否则返回0。
[C程序代码]
#include<stdio.h>
#include<stdlib.h>
int isPalm(long m)
{
int i=0, k=0;
char str[32];
while(m>0) {
str[k++]= (1) +’0’;
m=m/10;
}
for(i=0; i<k/2; i++)
if(str[i]!=str[ (2) ])return 0;
return 1;
}
int main( )
{
long n, a, t;
printf("input a positive integer: "); scanf("%ld", &n);
if(n<100||n>=1000)return -1;
while( (3) ) {
printf("%id->", n);
for(a=0, t=n; t>0; ){
a= (4) *10+t%10; t=t/10;
n= (5) ;
printf("%id/n", n);
system("pause"); return 0;

我来回答:

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

订单号:

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