当前位置:首页 » 课程大全 » c课程设计点菜系统

c课程设计点菜系统

发布时间: 2021-02-06 00:49:15

1. 用c语言做一个点菜系统。

这个任务比较艰苦,我有兴趣

2. C语言实习,餐厅点菜系统程序代码!

这个写起来需要时间,

3. 餐馆点餐系统C程序 C语言课程设计 模拟餐馆点菜系统 有谁做过课程设计吗急求!我要百度找不到的!

厉害。你要是平时学习上有问题,我倒是可以帮你,并且无需回报。考试就算了吧。爱莫能助。平时

4. C语言课程设计 模拟餐馆点菜系统 有谁做过课程设计吗急求! [email protected] 谢谢了

众博立餐饮管理系统,免费开源的餐饮管理系统。可以看看。

5. C语言编写点菜系统

简单的点菜系统,可供学习:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define SERVPORT 3333
#define MAXDATASIZE 100 /*每次最大数据传输量 */

int main(int argc, char *argv[])
{
int sockfd, recvbytes;
char buf[MAXDATASIZE];
struct hostent *host;
struct sockaddr_in serv_addr;
if (argc < 2)
{ fprintf(stderr,"Please enter the server's hostname!\
"); exit(1); }

if ((host=gethostbyname(argv[1]))==NULL)
{ perror("gethostbyname出错!"); exit(1); }

if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ perror("socket创建出错!"); exit(1); }
//初始化客户端
serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(SERVPORT);
serv_addr.sin_addr = *((struct in_addr *)host->h_addr);
bzero(&(serv_addr.sin_zero),8);
//connect
if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr)) == -1)
{ perror("connect error!"); exit(1); }
//recv
if ((recvbytes=recv(sockfd, buf, MAXDATASIZE, 0)) ==-1)
{ perror("recv出错!"); exit(1); }

buf[recvbytes] = '\\0';
printf("Received: %s",buf);
close(sockfd);
return 0;
}
客户端#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/wait.h>
#define SERVPORT 3333 /*服务器监听端口号 */
#define BACKLOG 10 /* 最大同时连接请求数 */

int main()
{
int sockfd,client_fd,sin_size; /*sock_fd:监听socket;client_fd:数据传输socket */
struct sockaddr_in my_addr; /* 本机地址信息 */
struct sockaddr_in remote_addr; /* 客户端地址信息 */
//创建一个套接字,PF_INET,流式,
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ perror("socket"); exit(1); }
//初始化服务端
my_addr.sin_family=AF_INET;
my_addr.sin_port=htons(SERVPORT);
my_addr.sin_addr.s_addr = INADDR_ANY;
bzero(&(my_addr.sin_zero),8);
//将套接字地址与所创建的套接字号联系起来
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1)
{ perror("bind"); exit(1); }
//愿意接收连接
if (listen(sockfd, BACKLOG) == -1)
{ perror("listen"); exit(1); }

while(1)
{
sin_size = sizeof(struct sockaddr_in);
if ((client_fd = accept(sockfd, (struct sockaddr *)&remote_addr, &sin_size)) == -1)
{ perror("accept"); continue; }

printf("received a connection from %s\
", inet_ntoa(remote_addr.sin_addr));

if (!fork()) { /* 子进程代码段 */

if (send(client_fd, "Hello, you are connected!\
", 26, 0) == -1)

perror("send"); close(client_fd); exit(0); }
close(client_fd); }
return 0;
}

6. c语言餐厅点菜系统

这个还是自己写吧 写完了 自己就学得差不多了

7. 求一个C语言编写的点餐系统。

你好!

有个类似的点餐程序,基本和你要求差不多

8. c语言点菜系统

// 下面是前期的点餐系统的基础数据维护,其它功能你可以自己尝试写,如果遇到什么问题可以提出来追问喔,相信你可以解决的(我怕代码太多提交会受字数限制)。

//mm.h头文件
#include<stdio.h>
#include<stdlib.h>
#defineMENU_NUM_MAX100//假设有100种菜式
#defineLENsizeof(structMenuInfo)
structMenuInfo
{
intID;
charMenuName[20];
floatprice;
}Menu[MENU_NUM_MAX];

/*基础数据维护*/
voidAddMenu()
{
FILE*fp;
intmenu_num;

printf(" 你要添加多少种菜?:");
scanf("%d",&menu_num);
for(inti=0;i<menu_num;i++)
{
printf(" ");//addedthisline
printf(" 请输入ID:");
scanf("%d",&Menu[i].ID);
printf(" 请输入菜名:");
scanf("%s",Menu[i].MenuName);
printf(" 请输入[%s]菜的价格:",Menu[i].MenuName);
Menu[i].price=0.0f;//initialfloatprice
scanf("%f",&Menu[i].price);
fflush(stdin);
}

if((fp=fopen("MenuInfo.dat","ab"))==NULL)//openbinaryfile
{
printf("Can'topenfile ");
exit(1);
}
for(intj=0;j<menu_num;j++)
{
if(fwrite(&Menu[j],LEN,1,fp)!=1)//writingdatatobinaryfile
printf("Errorwritingfile. ");
}
fclose(fp);//closefilepoint
}

voidDisplayMenuInfo()
{
FILE*fp;
printf(" ID菜名 价格 ");//columnheadings
if((fp=fopen("MenuInfo.dat","rb"))==NULL)//openbinaryfile
{
printf("Can'topenfile ");
exit(1);
}

inti=0;
do
{
fseek(fp,i*LEN,SEEK_SET);//movefileheadlocation
if(fread(&Menu[i],LEN,1,fp))//
{
printf(" %d%5s %5.1f元 ",Menu[i].ID,Menu[i].MenuName,Menu[i].price);
i++;
}
}while(!feof(fp));

fclose(fp);
}
voidDeleteToMenu()
{
FILE*fp;
intMenuID;
inttodelete=-1;
inti=0;
printf("请输入要删除的菜名的ID:");
scanf("%d",&MenuID);

/**/
if((fp=fopen("MenuInfo.dat","rb"))==NULL)//openbinaryfile
{
printf("Can'topenfile ");
exit(1);
}

do
{
fseek(fp,i*LEN,SEEK_SET);//movefileheadlocation
if(fread(&Menu[i],LEN,1,fp))
{
if(Menu[i].ID==MenuID)todelete=i;
i++;
}
}while(!feof(fp));
fclose(fp);

if(todelete==-1)
{
printf("AmenuwiththatIDdoesn'texist ");
}
else
{
/**/
if((fp=fopen("MenuInfo.dat","wb"))==NULL)//openbinaryfile
{
printf("Can'topenfile ");
exit(1);
}

for(intj=0;j<i;j++)
{
if(j==todelete)continue;/*skiprecordtobedeleted*/
if(fwrite(&Menu[j],LEN,1,fp)!=1)//writingdatatobinaryfile
printf("Errorwritingfile. ");
}
fclose(fp);//closefilepoint
}
}
voidFindMenu()
{
FILE*fp;
intMenuID;
boolfind_mark=false;
printf(" 请输入你要查找的菜名ID:");
scanf("%d",&MenuID);

printf(" ID菜名 价格 ");//columnheadings
if((fp=fopen("MenuInfo.dat","rb"))==NULL)//openbinaryfile
{
printf("Can'topenfile ");
exit(1);
}

inti=0;
do
{
fseek(fp,i*LEN,SEEK_SET);//movefileheadlocation
fread(&Menu[i],LEN,1,fp);//
if(Menu[i].ID==MenuID)
{
printf(" %d%5s %5.1f元 ",Menu[i].ID,Menu[i].MenuName,Menu[i].price);
find_mark=true;
break;
}

i++;
}while(!feof(fp));

if(!find_mark)printf(" 尊敬的客户:我们餐厅没有你要点的菜喔,你可以试试我们的招牌菜啊^-^. ");

fclose(fp);
}
/*基础数据维护完毕*/
//sc.cpp主文件
#include<stdio.h>
#include<stdlib.h>
#include"mm.h"
voidmain(void)
{
//AddMenu();
//DisplayMenuInfo();
//FindMenu();
}

9. 用C语言设计一个餐厅点菜系统

没有把事情说清.

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919