c语言中用cin输入数组内容,C++问题,关于CIN输入字符数组方面的错

做了一个函数:

#include

#include

#include

//

#define NULL 0

#define LEN sizeof(struct goods)

//

struct goods//建立结构体

{char name[10];

int number;

float price;

int date;

struct goods *next;

};

int n;//全局变量N

//

struct goods *creat(void)//构造函数

{struct goods *head;

struct goods *p1,*p2;

n=0;

p1=p2=(struct goods *)malloc(LEN);

cin>>&p1->name>>&p1->number>>&p1->price>>&p1->date;

head=NULL;

while(p1->name!=0)

{n++;

if(n==1)head=p1;

else p2->next=p1;

p2=p1;

p1=(struct goods *)malloc(LEN);

cin>>&p1->name>>&p1->number>>&p1->price>>&p1->date;

}

p2->next=NULL;

return(head);

}

试运行时总是出现报错,都是错在两个cin上.提示是

F:\c++程序\仓库管理.cpp(32) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'char (*)[10]' (or there is no acceptable conversion)

请教达人这是怎么回事啊

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值