单选题 C++
题号 #2607227

以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误原因是(    )。
#include<iostream.h>
void main()
{int * P,* q,a,b;
P=&a:
eout<<”input a:”;
cin>>P:

进入在线模考

参考答案

B

答案解析

P表示的是变量a的地址,定义后*P表示的是变量a的值。

你可能感兴趣的试题

A.for(int a=1;a<=10;a++);
B.int a=1;
do
{
a++:
}while(a<=10);
C.int a=1;
while(a<=10)
{
a++:
}
D.for(int a=1;a<=10;a++)a++;
A.char str[]={’a’,’b’,’C’}
B.char str[2]={’a’,’b’,’c’}
C.char str[2][3]={{’a’,’b’},{’C’,’d’},{’e’,’f’}}
D.char str()={~a,~b,~C}
找试题 · 找答案 · 找资料 在线模考