帮忙解释下 warning C4024: 'strcpy' : different types for formal and actual parameter
#include <stdio.h>#include <stdlib.h>
#include <string.h>
#define M 100
struct information{
char name[100];
char reason[100];
float money;
}em[100];
typedef struct information STUDENT;
void menu();
void input();
void save(int);
void sort(int n);
void display();
void menu()
{puts("1.input inform");
puts("2.Display inform");
puts("3.Exit");
printf("\n");
}
void mian()
{
int n,flag;
char a;
menu();
do
{
printf("Enter your Choice(1--3):\n");
scanf("%d",&n);
if(n>=1&&n<=3)
{
flag=1;
break;
}
else
{
flag=0;
printf("your Choice is false,Enter your Choice!");
}}
while(flag==0);
while(flag==1)
{
switch(n)
{
case 1:input();break;
case 2:display();break;
case 3:exit(0);break;
default:break;}
scanf("%c",&a);
if(a=='y')
{flag=1;
system("cls");
menu();
printf("Enter your Next Choice(1--2):\n");
scanf("%d",&n);
printf("\n");
}
else
exit(0);
}
}
void input()
{int i,m;
printf("Please Enter the number of student(1--100):\n");
scanf("%d",&m);
for(i=0;i<m;i++)
{
printf("\tname:");scanf("%s",&em[i].name);getchar();
printf("\treason:");scanf("%s",&em[i].reason);getchar();
printf("\tmoney:");scanf("%f",&em[i].money);getchar();}
printf("\n 创建完毕!\n");
save(m);main();
}
void save(int m)
{
int i;
FILE *fp;
if((fp=fopen("file1.txt","wb"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
for(i=0;i<m;i++)
if(fwrite(&em[i],sizeof(struct information),1,fp)!=1)
printf("file write error\n");
fclose(fp);}
int load()
{
FILE*fp;
int i=0;
if((fp=fopen("file1.txt","rb"))==NULL)
{
printf("can't open file1\n");
exit(0);
}
else
{
do
{
fread(&em[i],sizeof(struct information),1,fp);
i++;
}
while(feof(fp)==0);
}
fclose(fp);
return(i-1);
}
void sort(int n)
{
int i,j,flag;
STUDENT temp;
for(i=0;i<n;i++)
{
flag=0;
for(j=0;j<n-1;j++)
if((strcmp(em[j].name,em[j+1].name))>0)
{
flag=1;
strcpy(temp.name,em[j].name);
strcpy(temp.reason,em[j].reason);
strcpy(temp.money,em[j].money);
strcpy(em[j].name,em[j+1].name);
strcpy(em[j].reason,em[j+1].reason);
strcpy(em[j].money,em[j+1].money);
strcpy(em[j+1].name,temp.name);
strcpy(em[j+1].reason,temp.reason);
strcpy(em[j+1].money,temp.money);
}
if(flag==0)break;
}
printf("sort sucess!!! \n");
}
void display()
{
int i;
int m=load();
printf("%-5s%-8s%-5f\n","name","reason","money");
for(i=0;i<m;i++)
printf("\n%s\t%s\t%f\t\n",em[i].name,em[i].reason,em[i].money);
getchar();
main();
}