题库 第1002页
单选题:若有函数`max(a,b)`,并且已使函数指针变量`p`指向函数`max`,当调用函数时,正确的调用方法是
若有函数max(a,b),并且已使函数指针变量p指向函数max,当调用函数时,正确的调用方法是A.(*p)max(a+b);B.*pmax(a,b);C.(*p)(a,b);D.*p(a,b);答案:C…
单选题:宏定义`#define DIV(a, b) a/b`,经`DIV(x + 5, y - 5)` 引用,替换展开后是:
宏定义#define DIV(a, b) a/b,经DIV(x + 5, y - 5) 引用,替换展开后是:A.(x + 5 / y – 5)B.(x + 5) / (y - 5)C.x + 5 / y - 5D.(x + 5) / (y…
单选题:设有宏定义:`#define IsDIV(k, n) ((k%n==1)? 1: 0)`且变量`m`已正确定义并赋值,则宏调用:
设有宏定义:#define IsDIV(k, n) ((k%n==1)? 1: 0)且变量m已正确定义并赋值,则宏调用:IsDIV(m, 5)&& IsDIV(m, 7) 为真时所要表达的是A.判断m是否能被5和7整除B.判…
函数题:Expression
calc() is a function calculates an expression of natural numbers and zero. Only operators below are allowed in the expre…
函数题:分数
设计一个表示分数的类Fraction。这个类用两个int类型的变量分别表示分子和分母。注意,在创建和做完运算后应该化简分数为最简形式。如2/4应该被化简为1/2。### 函数接口定义:这个类的构造函数是:Fraction(int a, in…
函数题:形状继承
设计一个表示形状的类Shape,以及从Shape继承的表示矩形的类Rectangle和表示椭圆的类Ellipse。Shape类用一个表示坐标点的类Point的对象来表达它的左上角坐标,用一个表示尺寸的类Dimension的对象来表示它的大小…
编程题:切割绳子
有$N$条绳子,它们的长度分别为$L_i, i=1,\cdots,N$。如果从它们中切割出$K$条长度相同的绳子,这$K$条绳子每条最长能有多长?### 输入格式:第一行两个整数$n$和$k$($1<n<10000; 1<…
编程题:PY平均数
You are going to read a serial of none-negative integers, which ends with a negative number that does not count as one o…
编程题:Score Processing (Java)
Write a program to process students score data.The input of your program has lines of text, in one of the two formats:1.…
编程题:Prime Number
Your program reads a natural number in and judge if it is a prime number or not.### Input Format:A positive whole number…