大学网课搜题引擎
首页
爱课程(中国大学MOOC)
C++程序设计基础
第6章——指针:所向披靡的“金箍棒” 魂
题目详情
简答题
已知:int m=10;在下列语句中错误的是( )
A、int *p=new int(m);
B、int *p=new int[m]={0};
C、float *p=new float(m);
D、float *p=new float[m];
查看答案与解析
简答题
阅读程序,输出结果。 #include using namespace std; int main() { int a[3][2] = { 1, 2,4, 5 }; int *p; p = a[0]; cout " " " " " " p=a[1]; cout " " " " " " p=a[2]; cout " " " " " " return 0; } A、1 2 4 5 4 5 0 0 0 0 不确定 不确定 B、编译错误 C、1 2 4 5 0 0 0 0 0 0 不确定 不确定 D、1 2 4 5 4 5 0 0 不确定 不确定 不确定 不确定
简答题
下面程序的运行结果是( ).#include;using namespace std;int main ( ){ float a=1,b=2,c; float *p1=&a,*p2; p2=&b; c= * p1 + *p2; cout A、1 B、2 C、a D、b
简答题
阅读程序,请输出程序的结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout return 0; } A、11 11 B、11 16 C、11 12 D、16 16
简答题
下面程序的运行结果是( ). #includeusing namespace std;int main( ){int aa[3][3]={{1},{2},{3}},i,*p=&aa[0][0];for(i=0;i A、1 1 B、2 1 C、1 2 D、3 1
简答题
下列程序运行时的输出结果是( )。 #include using namespace std; int main() {int a[7]={23,15,64,33,40,58}; int s1,s2,*p; s1=s2=a[0]; for(p=a+1;*p;p++) {if(s1>*p) s1=*p; if(s2 cout return 0; } A、23 B、58 C、64 D、79
简答题
#include using namespace std; int main() { int a[5] = { 1, 2, 3, 4, 5 }; int *ptr = (int*)(&a + 1); cout return 0; } 程序运行结果是什么? A、2 5 B、编译错误 C、1 2 D、2 不确定
简答题
阅读程序,输出结果 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout return 0; } A、16 16 B、11 11 C、11 16 D、11 12
简答题
若定义 char s[2][3]={“ab”, “cd”}, *p=(char *)s; //字符型指针p存放的是字符串s的首地址,而字符串s表示的是这样一个字符串: 那么下列表达式语法正确,并且其值与 s[1][1]相等的表达式(并非一定与其等价)是() //根据字符串的表示,s[1][1]是字符‘d’ A、*(s+3) B、p[1][1] C、*(p+3) D、char(*++p+2)
简答题
阅读程序,输出结果 #include using namespace std; int main() { char *a[] = { "work", "at", "alibaba" }; char **pa = a; pa++; cout return 0; } A、at B、编译错误 C、work D、alibaba
简答题
下面程序的运行结果是( ). #include using namespace std; void main(void) { int a[5]={10,20,30,40,50}; int *p=&a[0]; p++; cout } A、10 B、21 C、31 D、41
简答题
阅读程序,请输出程序的结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout return 0; } A、11 11 B、11 16 C、11 12 D、16 17
简答题
如定义 int a[3][4]; 下面哪个不能表示 a[1][1]? A、*(&a[0][0]+5) B、*(*(a+1)+1) C、*(&a[1]+1) D、 *(a[1]+1)
简答题
阅读程序,输出结果 #include using namespace std; int main() { int a[3][4]={{0,1,2,10},{3,4,5,11},{6,7,8,12}}; cout cout cout cout cout return 0; } A、0 0 3 1 第一行的首地址 B、第一个元素地址 0 3 1 3 C、0 0 3 1 3 D、0 0 3 1 3 1
简答题
阅读程序,输出结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout cout cout return 0; } A、11 11 11 16 B、11 12 11 12 C、11 16 11 16 D、11 16 11 17
简答题
阅读程序,输出结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout cout cout return 0; } A、11 11 11 16 B、11 16 11 16 C、11 11 11 12 D、11 11 12 12
简答题
以下程序的功能是:将无符号八进制数字构成的字符串转换为十进制整数。例如,输入的字符串为:556,则输出十进制整数366。请在黄色处选择合适的语句。 #include using namespace std; int main() {char *p,s[6]; int n; p=s; cin>>p; n=*p-'0'; while( !='\0') n=n*8+*p-'0'; cout return 0; } A、*++p B、*p++ C、(*p)++ D、*p
简答题
阅读程序,输出结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout cout cout return 0; } A、11 11 11 12 B、11 16 11 16 C、11 12 11 12 D、11 11 11 16
简答题
已知数组arr的定义如下: int arr[5]={1, 2, 3, 4, 5}; 下列语句中输出结果不是2的是______。A.cout<<*arr+1<<endl;B.cout<<*(arr+1)<<endl;C.cout<<arr[1]<<endl;D.cout<<*arr<<endl;
简答题
阅读程序,输出结果。 #include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout cout cout return 0; } A、11 11 11 12 B、11 16 11 16 C、11 12 12 12 D、11 12 11 12
简答题
#include using namespace std; int main() { int a[]={11,16,13,14,15}; int *ptr = a; cout cout cout cout return 0; } A、11 11 11 16 B、11 11 12 12 C、11 12 11 16 D、11 16 11 17
C++程序设计基础
章节列表
第1章——初识C++语言:从认识变量和常量开始,数据的表示
9
第2章——计算:从数据运算开始,数据简单运算
9
第3章——分支结构:无处不在的抉择
11
第4章——循环结构:周而复始,求同存异
10
第5章——数组:实现算法的利器
10
第6章——指针:所向披靡的“金箍棒” 魂
30
第7章 函数:面向过程的基础
10
第8章 文件:让数据流动起来
20