1>c:\users\b\desktop\system\system\menu.c(86): error C2371: “copy”: 重定义;不同的基类型 错哪儿
voidadd()//添加卡{structCardcard;charaName[32]={'\0'};charaPwd[20]={'\0'};intnNamesize=0...
void add()//添加卡
{
struct Card card;
char aName[32]={'\0'};
char aPwd[20]={'\0'};
int nNamesize=0;
int nPwdsize=0;
printf("\n");
printf("-------添加卡-------\n");
printf("请输入卡号(长度为1~18):\n");
scanf_s("%s",aName);
printf("请输入密码(长度为1~8):\n");
scanf_s("%s",aPwd);
nNamesize=getSize(aName);
nPwdsize=getSize(aPwd);
if(nNamesize>18 || nPwdsize>8)
{
printf("密码或卡号超出规定范围/n");
return ;
}
copy(aName, card.aName , 18);
copy(aPwd, card.aPwd , 8);
printf("输入开卡金额(RMB):\n");
scanf_s("%f",&card.tBalance);
card.fTotalUse = card.tBalance ;
card.nDel=0 ;
card.nStatus=0;
card.nUseCount=0;
card.tEnd = card.tLastTime = card.tStart = time(NULL);
printf("添加卡信息成功\n");
printf("添加卡信息如下:\n");
printf("卡号\t密码\t状态\t开卡金额\n");
printf("%s\t%s\t%d\t%0.1f\n",card.aName, card.aPwd, card.nStatus, card.tBalance);
printf("\n");
}
int getSize(const char* pInfo) //密码或卡号长度
{
int nSize=0;
while(*(pInfo+nSize) != '\0')
{
nSize++;
}
return nSize;
}
void copy(const char aInput[],char aOutput[], int nSize)
{
int i = 0;
for(i = 0;i < nSize; i++)
{
aOutput[i]=aInput[i];
if(aInput[i] == '\0')
{
break;
}
}
}
帮帮忙 展开
{
struct Card card;
char aName[32]={'\0'};
char aPwd[20]={'\0'};
int nNamesize=0;
int nPwdsize=0;
printf("\n");
printf("-------添加卡-------\n");
printf("请输入卡号(长度为1~18):\n");
scanf_s("%s",aName);
printf("请输入密码(长度为1~8):\n");
scanf_s("%s",aPwd);
nNamesize=getSize(aName);
nPwdsize=getSize(aPwd);
if(nNamesize>18 || nPwdsize>8)
{
printf("密码或卡号超出规定范围/n");
return ;
}
copy(aName, card.aName , 18);
copy(aPwd, card.aPwd , 8);
printf("输入开卡金额(RMB):\n");
scanf_s("%f",&card.tBalance);
card.fTotalUse = card.tBalance ;
card.nDel=0 ;
card.nStatus=0;
card.nUseCount=0;
card.tEnd = card.tLastTime = card.tStart = time(NULL);
printf("添加卡信息成功\n");
printf("添加卡信息如下:\n");
printf("卡号\t密码\t状态\t开卡金额\n");
printf("%s\t%s\t%d\t%0.1f\n",card.aName, card.aPwd, card.nStatus, card.tBalance);
printf("\n");
}
int getSize(const char* pInfo) //密码或卡号长度
{
int nSize=0;
while(*(pInfo+nSize) != '\0')
{
nSize++;
}
return nSize;
}
void copy(const char aInput[],char aOutput[], int nSize)
{
int i = 0;
for(i = 0;i < nSize; i++)
{
aOutput[i]=aInput[i];
if(aInput[i] == '\0')
{
break;
}
}
}
帮帮忙 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询