单项选择题

下列函数的运行结果是( )。
#include<iostream.h>
int f(int a,int b)
int c;
if(a>b)c=1;
else if(a==b)c=0;
else c=-1;
return(c);
void main()
int i=2,j=3;
iht p=f(i,j);
cout<<p;

A.-1
B.1
C.2
D.编译出错,无法运行
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序: #include<iostream> using namespace std; class Con char ID; public: Con():ID(’A’)cout<<1; Con(char ID):ID(ID’)cout<<2; Con(Con&c):ID(c.getID())cout<<3; char getID()constreturnID; ; void show(Con c)tout(c.getID(); int main() Con c1; show(c1); Con c2(’B’); show(c2); return 0; 执行上面程序的输出是( )。
A.13A23A
B.23A13B
C.13A23B
D.13B23A
单项选择题
C++语言本身没有定义I O操作,但I O操作包含在C++实现中。C++标准库iostream提供了基本的I O类。I O操作分别由两个类istream和( )提供。
A.fstream
B.iostream
C.ostream
D.cin
相关试题
  • 有如下程序 #include<iostream.h> vo...
  • 有以下程序: Class Date public: Dat...
  • 如有下程序: #include<iostream> usi...