我不知道你是什么编辑器,我用的是dev C++ 发现new是一个关键字,还有许多函数应用没有用头文件
/*网页上的程序*/
#include
#include
#include
#include
typedef struct worker
{
int num;
char name[20];
char sex;
int age;
}Linklist;
void ccode(char * , int *);
void menu();
int main(void)
{
void menu();
void ccode();
menu();
}
void menu()
{
int choose,flag=0,i;
char *p1;
int *p2; /*密码 和 标志 都改变其值*/
char code[10],change[]="520",ch;
p1=change;
p2=&flag;
Start: /*为了让密码 不在重置*/
printf(" Workers Information Query System\nPlease give the code to enter the System:");
for( ; flag == 0 ; )
{
for(i=0 ; ((ch=getch())!='\r') && (i < 10 ); i++) /*回车是/r 换行才是/n*/
{
code[i]=ch;
printf("*");
}
code[i]='\0'; /* 记住在这里的后面加上一个结束的标识符*/
if(strcmp(code,p1)==0) /*这里用不用指针都没有关系*/
{
flag=1;
}
else
printf("\nSorry! the code you give is wrong,please re-enter it as confirmation:\n");
}
system("cls");
printf(" Workers Information Query System\nPlease choose the survice as follow:\n 1.Information for all workers\n 2.Workers search\n 3.Change the information of workers\n");
printf(" 4.Adding workers\n 5.Password reset\n 6.Dismiss workers\n 7 End");
scanf("%d",&choose);
switch(choose)
{
case 5:ccode(p1,p2);goto Start;
}
}
void ccode(char *p1 , int *p2)
{
char old[10];
char new1[10];
printf("Please input the old password:");
/*gets(old);*/
scanf("%s",old);
if(strcmp(old,p1)!=0)
{
menu(); /*如果输入不正确 就要返回菜单 这个设置 应该在完善一下*/
}
else
{
printf("Please input the new password:");
gets( new1 );
strcpy(p1 , new1);
*p2=0;
}
printf("Succee!\n");
system("pause");
system("cls");
}