填空题
函数swap(arr,n)可完成对arr数组从第1个元素到第n个元素两两交换。在运行调用函数中的语句后,a[0]和a[1]的值分别为
【7】
。 a[0]=1;a[1]=2;swap(a,2);
【参考答案】
2,1
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
设有定义语句:double x=2.5, y=4.7;int a=7;那么表达式x+a%3*(int)(x+ y)%2 4的值为 【6】 。
点击查看答案&解析
单项选择题
有以下程序:#include <iostream>using namespace std;class sample{private: int n;public: sample() {} sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n-s1.n+s2.n; return (*this); void disp() { cout << n= <<n<<end1; } };int main (}{ sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0;}程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
点击查看答案&解析
相关试题
下面是“二维向量”vector2D的定义,其中...
已知:double A(double A) {return+...
有以下程序:#include<iostream.h>clas...
下面程序的输出结果是 【15】 。#incl...
在下面横线上填上适当的语句,完成程序。#...