更多"请写出下列C语言程序的输出结果是______。
#includ"的相关试题:
[简答题]根据下列C语言程序,请写出输出结果。
#include<stdio.h>
void swap(int x,int y)
{
int temp=x;
x=y;
y=temp;
}
main( )
{
int m=3,n=5;
swap(m,n);
printf("%d,%d",m,n);
}
[单项选择]该程序的输出的结果是
A. 12
B. 13
C. 14
D. 15
[填空题]执行下面程序,第一行输出结果是 ,第二行输出结果是 。
Option Explicit
Private Sub Form_Click( )
Dim A As Integer
A=2
Call Subl(A)
End Sub
Private Subl(x As Integer)
x=x*2+1
If x<10 Then
Call Subl(x)
End If
x=x*2+1
Print x
End Sub
[单项选择]下面程序输出的结果是什么 ( )
public class Quiz2
public static void main(String args[])
try throw new MyException( );
catch(Exception e)
System.out.println("It’s caught!");
finally
System.out.println("It’s finally caught!");
class MyExeeption extends Exception
A. It’s finally caught!
B. It’s caught!
C. It’s caught!/It’sfinally caught!
D. 无输出
[单项选择]下列程序中,若从键盘中输入的是大写字母C,则程序输出的结果是( )。
Importjava.io.*;
public class Exam{
public static void main(String args[]){
int ch=0;
System.out.println("输入一个字符:");
try{
ch=System.in.read( );
charch_A=’A’,ch_Z=’Z’;
int delta c=(int)ch A+(int)ch Z-ch;
syStem. out.println("编码后的字符为:"+(char)delta_c);
}
catch(IOException e){
e.printStackTrace( );
}
}
}
A. C
B. Y
C. X
D. 字母C的ASCIl码的整型值
[填空题]执行下面程序,第一行输出结果是 【14】 ,第二行输出结果是47。
Option Explicit
Private Sub Form_Click( )
Dim A As Integer
A=2
Call Sub1 (A)
End Sub
Private Sub1 (x As Integer)
x=x*2+1
If x<10 Then
Call Sub1 (x)
End If
x=x*2+1
Print x
End Sub
[填空题]执行下面程序,第一行输出结果是 【14】 ,第二行输出结果是47。
Option Explicit
Private Sub Form_Click( )
Dim A As Integer
A=2
Call Sub1 (A)
End Sub
Private Sub1 (x As Integer)
x=x*2+1
If x<10 Then
Call Sub1 (x)
End If
x=x*2+1
Print x
End Sub
[简答题]如下程序是为变量i赋值。若程序的输出结果是180。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
class Base
{
int i;
Base( )
{
add(10);
}
void add(int v)
{
i+=v;
}
void print( )
{
System.out.println(i);
}
}
class Extension extends Base
{
Extension( )
{
add(______);
}
void add(int v)
{
i+=v*2;
}
}
public class ConstructTest3
{
public static void main(String args[])
{
bogo(new Extension( ));
}
static void bogo(Base b)
{
b.add(60);
b.print( );
}
}
[填空题]下列程序输出结果是 【13】 。
include <iostream>
using namespace std;
template <typename T>
T fun(T a, T b) return (a<=b)a:b;
int main( )
cout<<fun(3,6)<<’,’<<fim(3.14F, 6.28F)<<end 1;
return 0;
[填空题]以下由C语言编写的程序,运行后输出结果是______。
#include〈stdio.h〉
void fun(int x)
if(x/2>1)fun(x/2):
Printf(“%d”,x):
Main( )
fun(7);printf(“/n”);
[单项选择]如下程序是为变量i赋值。若程序的输出结果是180。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
class Base
int i;
Base( )
add(10);
void add(int v)
i+=v;
void print( )
System.out.println(i);
class Extension extends Base
Extension( )
add(______);
void add(int v)
i+=v*2;
public class ConstructTest3
public static void main(String args[])
bogo(new Extension( ));
static void bogo(Base b)
b.add(60);
b.print( );