单项选择题

有以下程序:
#include<iostream>
using namespace std;
int f(int,int);
int main()

int i:1,x;
x=f(i,i+1);
cout<<x<<end1;
return 0;

int f(int a,int b)

int c;
c = a;
if(a>b)
c = 1;
else if(a==b)
c = 0;
else
c = -2;
return c;

运行后的输出结果是( )。

A) 1
B) 0
C) -1
D) -2
<上一题 目录 下一题>
热门 试题

单项选择题
有如下类声明: class MyBASE int k; public: void set(iht n)k=n; int get()coastreturn k; ; class MyDERIVED:pnoted My BASE protected: int j; public: void set(int m,int n)MyBASE::set(m);j=n; int get()constreturn MyBASE::get()+j; ; 则类MyDERIVED中保护的数据成员和成员函数的个数是A)4 B)3 C)2 D)1
单项选择题
下列程序的输出结果是( )。 #include <iostream> using namespace std; int main() char a[]= Hello,World ; char *ptr=a; while(*ptr) if(*ptr>='a'&&*ptr<='z') cout<<char(*ptr+'A'-'a'); else cout<<*ptr; ptr++; retur 0;
A.HELLO,WORLD
B.Hello,World
C.hELLO,world
D.hello,world
相关试题
  • 已有函数fun(a,b),为了使函数指针变量P...
  • 已知int DBL(int n)return n+n;和lo...
  • 创建对象数组时,对数组的每一个元素都将调...
  • 执行下列语句后,变量sum的值是_____...
  • 设有二维数组int a [10][20];,...