单选题:以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误的原因是(  )。 #include(iostream.h

  • 题目分类:C++
  • 题目类型:单选题
  • 查看权限:VIP
题目内容:
以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误的原因是(  )。
#include(iostream.h)
voidmain(  )
{int*P,*q,a,b;
p=&a;
cout<<"inputa:";
cin>>P;
} A.*P表示的是指针变量P的地址
B.P表示的是变量a的地址,而不是变量a的值
C.*P表示的是指针变量p的值
D.*P只能用来说明P是一个指针变量

参考答案:
答案解析:

程序中有语句:for(inti=0;i<5;i++)cout<<*(p+i)<<",";能够依次输出int型一维数组a的

程序中有语句:for(inti=0;i<5;i++)cout<<*(p+i)<<",";能够依次输出int型一维数组a的前5个元素。由此可知,变量P的定义及初始

查看答案

有下列程序: #include<stdi0.h>intb=2; intfun(int*k){b=*k+b;return(

有下列程序: #includeintb=2; intfun(int*k){b=*k+b;return(b);)voidmain(

查看答案

设有定义“chars[8];inti=0;”,下列不能将一行(不超过80个字符)带有空格的字符国正确读入的语句或语句组是

设有定义“chars[8];inti=0;”,下列不能将一行(不超过80个字符)带有空格的字符国正确读入的语句或语句组是(  )。 A.gets(s); B.w

查看答案

Which of the following arguments does the author want to ma

Which of the following arguments does the author want to make?A.Money is all th

查看答案

What does the man ask the woman to do?

What does the man ask the woman to do?A.To park the Car elsewhere. B.To drive al

查看答案