| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 805 人关注过本帖
标题:main函数为什么黑提示local function definitions are illegal
只看楼主 加入收藏
教授小黑
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2014-12-16
结帖率:0
收藏
已结贴  问题点数:10 回复次数:2 
main函数为什么黑提示local function definitions are illegal
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct system{
int name; /*系统人员姓名录入*/
int number;  /*系统人员密码录入*/
int p;  /*系统人员电话录入*/
int customer; /*顾客信息录入*/
};
struct sysuser{
char sysname[15];
char sysword[8];
char fename[15];
char feword[8];
}su;
void encrypt(char *pwd);
int inputchoice(struct sysuser *psu);

void encrypt(char *pwd)
{
unsigned int i;

for(i=0;i<strlen(pwd);i++)
pwd[i]=pwd[i]^15;
}

int inputchoice(struct sysuser *psu)
{
FILE *fp;
char usr[30],usr1[30];
char use[30],use1[30];
char pwd[8];
int choice,mychoice;
printf("**********界面管理**********\n");
printf("**********选择人员**********\n");
printf("******1-系统人员,2-服务员******\n");
scanf("%d",&choice);
if(choice==1){
printf("输入系统人员账号:");
scanf("%s\n",su.sysname);
printf("输入密码:");
scanf("%s\n",su.sysword);
strcpy(usr,psu->sysname);
strcpy(pwd,psu->sysword);
encrypt(pwd);
strcat(usr," ");strcat(usr,pwd);strcat(usr,"\n");
if((fp=fopen("c:\\system.txt","r"))==NULL){
printf("File open error!\n");
exit(0);
}
while(!feof(fp)){
fgets(usr1,23,fp);
if(strcmp(usr,usr1)==0){
printf("11-创建系统新用户:\n");
printf("12-用户信息管理:\n");
printf("13-菜单信息管理:\n");
printf("14-综合测评:\n");
printf("15-顾客信息浏览:\n");
}
if(fclose(fp)){
printf("can not close the file!\n");
exit(0);
}
}
if(choice==2){
printf("输入服务员账号:");
scanf("%s",su.fename);
printf("输入密码:");
scanf("%s",su.feword);
strcpy(use,psu->fename);
strcpy(pwd,psu->feword);
encrypt(pwd);
strcat(use," ");strcat(use,pwd);strcat(use,"\n");
if((fp=fopen("c:\\feman.txt","r"))==NULL){
printf("File open error!\n");
exit(0);
}
while(!feof(fp)){
fgets(use1,23,fp);
if(strcmp(use,use1)==0){
printf("21-顾客信息录入:\n");
printf("22-菜单信息:\n");
printf("23-顾客点餐:\n");
printf("24-费用计算:\n");
printf("25-餐桌信息:\n");
}
            if(fclose(fp)){
    printf("can not close the file!\n");
    exit(0);
}
}

return mychoice;
}

int main(void)
{
FILE *fp;
int mychoice;
size=sizeof(struct system);
while((mychoice=inputchoice(psu))!=0){
switch(mychoice){
case 11:
void addnew();/*添加新用户*/
break;
case 12:
void newmanage();/*用户管理*/
break;
case 13:
void menu();/*菜单信息*/
break;
case 14:
void statistics();/*统计函数*/
break;
case 15:
void customer();/*顾客信息管理*/
break;
case 21:
void addcustomer();/*顾客信息录入*/
break;
case 22:
void menu();/*菜单信息*/
break;
case 23:
void food();/*顾客点餐*/
break;
case 24:
void money();/*费用计算*/
break;
case 25:
void desk();/*餐桌信息*/
break;
}
}
return 0;
}

void addnew()
{
搜索更多相关主题的帖子: function customer include system number 
2015-04-11 11:48
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:5 
老谭的学生?

授人以渔,不授人以鱼。
2015-04-11 12:00
xingjinda
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:35
专家分:125
注 册:2012-11-17
收藏
得分:5 
搜一下main函数的定义,唉,死在初学的路上。
2015-04-12 20:32
快速回复:main函数为什么黑提示local function definitions are illegal
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017501 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved