如何用c語言來編寫噪聲計tes1352a的通訊協議

  • 作者:由 匿名使用者 發表于 書法
  • 2022-11-10

如何用c語言來編寫噪聲計tes1352a的通訊協議淑女範兒2019.03.20 回答

#include #include #include #include //包含system函式標頭檔案 #define LEN sizeof(struct student) struct student { char num[20];//ID號碼 char name[100];//使用者姓名 char phone[20];//電話號碼 char home[100];//通訊地址 char birthday[20];//出生日期 struct student *next; }; void face(void)//功能選擇面板 { printf(“********************************************************************”); printf(“\t\t\t\t☆★☆★☆★ ~_~ ~_~ ~_~ ☆★☆★☆★\n”); printf(“\n\t\t\t☆★歡迎使用阿冬子通訊錄☆★”); printf(“\n\n\t☆★選擇你需要操作的功能:☆★(現無記錄,建議先填加記錄)★☆\n”); printf(“\n”); printf(“\t\t\t1。【增加通訊錄資訊〗\n”); printf(“\t\t\t2。〖顯示通訊錄中所有記錄】\n”); printf(“\t\t\t3。【刪除需要刪除的資訊〗\n”); printf(“\t\t\t4。〖以名字查詢所需的資訊】\n”); printf(“\t\t\t5。【儲存通訊錄中的所有記錄到指定檔案中〗\n”); printf(“\t\t\t6。〖退出不儲存!!】\n”); printf(“\n”); printf(“\t☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★”); printf(“\n\n********************************************************************\n\n”); } void print(struct student *head) { struct student *p; p=head; system(“CLS”);//呼叫DOS命令CLS能夠清屏 printf(“*************************************************************\n”); printf(“==================== → 使用者資訊記錄表 ← ===================\n”); printf(“*************************************************************\n”); if(head!=NULL) do { printf(“聯絡人ID號碼:%s\n”,p->num); printf(“聯絡人姓名:%s\n”,p->name); printf(“聯絡人電話號碼:%s\n”,p->phone); printf(“學生地址:%s\n”,p->home); printf(“聯絡人出生日期:%s\n”,p->birthday); printf(“********************************************************\n”); p=p->next; }while(p!=NULL); else { printf(“對不起!!沒有任何聯絡人記錄!!\n\n”); printf(“=============================================================\n”); } } //增添電子通訊錄中的內容,即建立連表過程 struct student *append(struct student *head) { struct student *p0=NULL,*p1,*p2;//p0為要插入的新節點 p1=head; p2=head; system(“CLS”); printf(“\n\n***********************************************************\n”); printf(“\t\t你能在此目錄下建立並新增聯絡人資訊”); printf(“\n***********************************************************\n”); p0=(struct student *)malloc(LEN); printf(“請輸入聯絡人ID號碼:”); gets(p0->num); printf(“請輸入聯絡人姓名:”); gets(p0->name); printf(“請輸入聯絡人電話號碼:”); gets(p0->phone); printf(“請輸入聯絡人地址:”); gets(p0->home); printf(“請輸入聯絡人出生日期:”); gets(p0->birthday); //對插入的節點排序,按姓名的拼音順序 if(head==NULL) {head=p0;p0->next=NULL;} else { while((strcmp(p0->name,p1->name)>0)&&(p1->next!=NULL)) {p2=p1;p1=p1->next;} if((strcmp(p0->name,p1->name))<=0) { if(head==p1) head=p0; else p2->next=p0; p0->next=p1; } else {p1->next=p0;p0->next=NULL;} printf(“恭喜你!!成功添加了聯絡人資訊!!”); printf(“\n************************************************************\n”); printf(“\n\n”); } return(head);

Top