更多"执行下面程序时,若输入1、-5、6,则输出结果为( )。 # inc"的相关试题:
[填空题]执行以下程序时,若输入end<回车>,则输出结果是 【18】 。
main( )
{char ch[10]="Begin";
gets(&ch[1]); puts(ch);
}
[单项选择]8位D/A转换器,当输入数字量10000000时输出电压为5V,若输入为10001000,输出电压为()V。
A. 5.44
B. 5.76
C. 6.25
D. 6.84
[填空题]以下程序的功能是:将输入的正整数按逆序输出。例如:若输入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");
[单项选择]以下程序执行后的输出结果是
#include<iostream>
using namcspace std;
void try(int,int,int,int);
int main( )
int x,y,z,r;
x=1;
y=2;
try(x,y,z,r);
cout<<r<<end1;
return 0;
void try(int x,int y, int z,int r)
z = x+y;
x = x*x;
y = y*y;
r = z+x+y;
A. 18
B. 9
C. 10
D. 不确定
[单项选择]下面程序执行后的输出结果为( )。
public class fun
public static void main(String args[])
String greets="How are you!";
String s=greets.substring(0,3);
System.out.println(S);
A. How
B. are.
C. you
D. how ate you!
[单项选择]以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A. 18
B. 9
C. 10
D. 不确定
[单项选择]若输入“abcdef”、“abdef”,以下程序的输出结果为( )。
#include<stdio.h>
#lnclude<string.h>
main( )
int n;
char s1[20],s2[20],p1,*p2;
scanf("%s",s1);
scanf("%s",s2);
P1=s1;
p2=s2;
n=strcmp(p1,p2);
printf("%d/n",n);
A. -1
B. 0
C. "abcdef"
D. "abdef"
[填空题]如下程序执行后的输出结果是 【14】 。
#include <iostream>
using namespace std;
class Base
{
public:
Base(int x,int y)
{
a=x;
b=y;
}
void Show( )
{
cout<<"Base: "<<a<< ’,’ <<b<<" ";
}
private:
int a,b;
};
class Derived : public Base
{
public:
Derived(int x, int y, int z) : Base(x,y),c(z) { }
void Show( )
{
cout<<"Derived:"<<c<<end1;
}
private:
int c;
};
int main( )
{
Base b(100,100),*pb;
Derived d(10,20,30);
pb=&b;
pb->Show( );
pb=&d;
pb->Show( );
return 0;
}
[单项选择]以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A. 18
B. 9
C. 10
D. 不确定
[填空题]如下程序执行后的输出结果是 【14】 。
#include <iostream>
using namespace std;
class Base
public:
Base(int x,int y)
a=x;
b=y;
void Show( )
cout<<"Base: "<<a<< ’,’ <<b<<" ";
private:
int a,b;
;
class Derived : public Base
public:
Derived(int x, int y, int z) : Base(x,y),c(z)
void Show( )
cout<<"Derived:"<<c<<end1;
private:
int c;
;
int main( )
Base b(100,100),*pb;
Derived d(10,20,30);
pb=&b;
pb->Show( );
pb=&d;
pb->Show( );
return 0;
[填空题]若输入3、4、5,程序的输出结果为
【6】 。
#include "math.h"
main ( )
float a, b, c, s, area;
scanf("%f,%f,%f",&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt (s* (s-
- a) * (s-
- b) * (s-
- c));
printf ("a=%7.2f,b=%7.2f, c=%7.2f, s=%7.2f", a,b, c, s);
printf ("area=%7.2f/n", area);
[填空题]以下程序运行后,若输入:3,abcde <回车>,则输出结果是 【11】 。
#include <stdio.h>
#include <string.h>
move(char *str,int n)
{ char temp; int i;
temp=str[n-1];
for(i=n-1;i>0;i--) str[i]=str[i-1];
str[0]=temp;
}
main( )
{ char s[50]; int n,i,z;
scanf("%d,%s",&n,s);
z=strlen(s);
for(i=1;i<=n;i++) move(s,z);
printf("%s/n",s);
}
[填空题]若输入3、4、5,程序的输出结果为 【6】 。
#include "math.h"
main ( )
{ float a, b, c, s, area;
scanf("%f,%f,%f",&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt (s* (s-a) * (s-b) * (s-c));
printf ("a=%7.2f,b=%7.2f, c=%7.2f, s=%7.2f", a,b, c, s);
printf ("area=%7.2f/n", area);
}
[单项选择]以下程序执行后的输出结果是 ( )。
#include <iostream.h>
class Basel
public:
void fun( ) cout<<"Basel"<<end1;
;
class Base2
public:
void fun( ) cout<<"Base2"<<end1;
class Derived : public Basel,public Base2
;
void main( )
Derived Obj;
Obj.fun( );
A. Basel
B. Base2
C. BaselBase2
D. 程序产生二义性