當前位置:首頁 » 課程大全 » 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