| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1848 人关注过本帖
标题:自己写的东西不知道问题出在哪里,,,,刚写完开始调试。。代码没报错,运 ...
只看楼主 加入收藏
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
结帖率:50%
收藏
已结贴  问题点数:10 回复次数:13 
自己写的东西不知道问题出在哪里,,,,刚写完开始调试。。代码没报错,运行中断。。。。。
程序代码:
#include<stdio.h>

#include<string.h>
#include<stdlib.h>
typedef struct FLIGHT

 {
     char plane_num[10];//航班号
    char city1[20];//起飞城市
    char city2[20];//抵达城市
    char time1[20];
     char time2[20];
     int plane_room;//空座数
    float price;
     float zhekou;
     int sit;//满仓否
    struct FLIGHT *next;

 }fly;
typedef struct CUSTOMEER

 {
     char name[10];
     char ID[20];
     char flight_num[10];//航班号
    int ticket_num;//票数
    int order_num;//订单号
    struct CUSTOMEER *next;

 }cus;
typedef struct costomers

 {
     cus *head;
     cus*rear;

 }customers;  //储存客户节点的链表
void init_fly(fly *P)

 {
     P = (fly*)malloc(sizeof(fly));
     if (P == NULL)exit(0);
     P->next = NULL;

 }
void init_customers(customers *Q)

 {
     Q = (customers*)malloc(sizeof(customers));
     Q->head = (cus*)malloc(sizeof(cus));
     Q->rear = Q->head;
     Q->rear->order_num = 0;
     Q->head->next = NULL;

 }
void insert_flight(fly *P, char *plane_num, char *city1, char *city2, char *time1, char *time2, int plane_room, float price, float zhekou, int sit)

 {
     fly *q;
     q = (fly*)malloc(sizeof(fly));
     strcpy_s(q->plane_num, plane_num);
     strcpy_s(q->city1, city1);
     strcpy_s(q->city2, city2);
     strcpy_s(q->time1, time1);
     strcpy_s(q->time2, time2);
     q->plane_room = plane_room;
     q->price = price;
     q->zhekou = zhekou;
     q->sit = sit;
     q->next = NULL;
     P->next = q;
     P = P->next;

 }
void insert_customers(fly *P, customers *Q, char *name, char *ID, char *flight_num, int ticket_num)

 {
     fly *h = (P)->next;
     for (; h != NULL; h = h->next)
     {
         if (strcmp(flight_num, h->plane_num) == 0)
         {
             h->plane_room = h->plane_room - ticket_num;
             if (h->plane_num == 0)
                 h->sit = 1;
         }

     }
     cus *q;
     q = (cus*)malloc(sizeof(cus));
     strcpy_s(q->name, name);
     strcpy_s(q->ID, ID);
     strcpy_s(q->flight_num, flight_num);
     q->ticket_num = ticket_num;
     q->next = NULL;
     Q->rear->next = q;
     q->order_num = Q->rear->next->order_num + 1;//生成订单号
    Q->rear = q;

 }
void delate_flight(fly *P)

 {
     fly *p, *pr;
     char flight_num[10];
     int mark = 1;
     pr = P;
     p = pr->next;
     printf("请输入你要删除的航班号:");
     scanf_s("%s", flight_num,sizeof(flight_num));
     while (p != NULL)
     {
         if (strcmp(flight_num, p->plane_num) == 0)
         {
             pr->next = p->next;
             free(p);
             printf("删除航班%s成功!\n", flight_num);
             mark = 0;
             p = NULL;
         }
         if (pr->next != NULL)
         {
             pr = pr->next;
             p = pr->next;
         }
         if (mark == 1)
             printf("没有要删除的航班\n");
     }


 }
int delate_customer(customers *Q, fly *P, char *name, char *ID)

 {
     cus *p, *pr;
     fly *q;
     pr = Q->head;
     p = pr->next;
     while (p != NULL)
     {
         if (strcmp(name, p->name) == 0 && strcmp(ID, p->ID) == 0)
         {
             for (q = P->next; q != NULL; q = q->next)
             {
                 if (strcmp(p->flight_num, q->plane_num) == 0)
                 {
                     q->plane_room = q->plane_room + p->ticket_num;
                     q->sit = 0;
                     break;
                 }
             }
             pr->next = p->next;
             free(p);
             printf("顾客%s,%s退票成功\n", name, ID);
             return 1;
         }
         pr = pr->next;
         p = pr->next;
     }
     printf("没有要操作的客户!\n");
     return 0;

 }
void creat_fly(fly *P)

 {
     fly *p;
     p=P;
     char plane_num[10], city1[20], city2[20], time1[20], time2[20];
     int plane_room, sit, mark = 1;
     float price, zhekou;
     if (p != NULL)
         p = p->next;
     while (mark == 1)
     {
         printf("请输入航班号:");
         scanf_s("%s", plane_num, sizeof(plane_num));
         printf("请输入出发地:");
         scanf_s("%s",city1,sizeof(city1));
         printf("请输入终点站:");
         scanf_s("%s", city2, sizeof(city2));
         printf("请输入起飞时间:");
         scanf_s("%s",time1,sizeof(time1));
         printf("请输入抵达时间:");
         scanf_s("%s",time2,sizeof(time2));
         printf("请输入票价:");
         scanf_s("%f",&price);
         printf("请输入折扣:");
         scanf_s("%f",&zhekou);
         printf("请输入座位数:");
         scanf_s("%d",&plane_room);
         printf("请输入是否满仓(0表示未满,1表示满仓):"); 
         scanf_s("%d",&sit);
         insert_flight(p, plane_num, city1, city2, time1, time2, plane_room, price, zhekou, sit);
         printf("增加航班成功!\n");
         printf("是否继续增加航班(1表示继续,0表示停止):");
         scanf_s("%d", &mark);
     }

 }
int city_chaxun(fly *P, char *city1, char *city2)

 {
     fly *p = P;
     int mark = 0;
     printf("%-8s%-12s%-12s%-10s%-10s%-8s%-6s%-10s%-8s\n", "航班号", "起飞城市", "终点城市", "起飞时间", "抵达时间", "价格",
         "折扣", "空座数", "满仓否" );
     for (; p != NULL; p = p->next)
     {
         if (strcmp(p->city1, city1) == 0 && strcmp(p->city2, city2) == 0)
         {
             printf("%-8s%-12s%-12s%-10s%-10s%-8.2f%-6.2f%-10d%-8d\n", p->plane_num, p->city1, p->city2, p->time1, p->time2, p->price, p->zhekou, p->plane_room,
                 p->sit);
             mark = 1;
         }
     }
     if (mark == 0)
     {
         printf("抱歉没有找到相应航班信息\n");
         return 0;
     }
     return 1;

 }
int num_cahxun(fly *P, char *plane_num)

 {
     fly *p = P;
     printf("%-8s%-12s%-12s%-10s%-10s%-8s%-6s%-8s%-10s\n", "航班号", "起飞城市", "终点城市", "起飞时间", "抵达时间", "价格",
         "折扣", "空座数", "满仓否");
     for (; p != NULL; p = p->next)
     {
         if (strcmp(p->plane_num, plane_num) == 0)
         {
             printf("%-8s%-12s%-12s%-10s%-10s%-8.2f%-6.2f%-10d%-8d\n", p->plane_num, p->city1, p->city2, p->time1, p->time2, p->price, p->zhekou, p->plane_room,
                 p->sit);
             return 1;
         }
     }
     printf("sorry,没有要查询的航班!\n");
     return 0;

 }
void xianshi_plane(fly *P)

 {
     fly*p = P;
     int i = 0;
     printf("%-8s%-12s%-12s%-10s%-10s%-8s%-6s%-10s%-8s\n", "航班号", "起飞城市", "终点城市", "起飞时间", "抵达时间", "价格",
         "折扣", "空座数", "满仓否");
     for (; p != NULL; p = p->next)
     {
         printf("%-8s%-12s%-12s%-10s%-10s%-8.2f%-6.2f%-10d%-8d\n", p->plane_num, p->city1, p->city2, p->time1, p->time2, p->price, p->zhekou, p->plane_room,
             p->sit);
         i = 1;
     }
     if (i == 0)
         printf("航班信息为空!\n");

 }
int same_plane(fly *P, char *plane_num)

 {
     fly *p = P->next, *q = P->next;
     int mark = 0;
     printf("%-8s%-12s%-12s%-10s%-10s%-8s%-6s%-10s%-8s\n", "航班号", "起飞城市", "终点城市", "起飞时间", "抵达时间", "价格",
         "折扣", "空座数", "是否满仓");
     while (p != NULL&&strcmp(p->plane_num,plane_num)!=0)
     {
         p = p->next;
     }
     while (q != NULL)
     {
         if (strcmp(p->city1, q->city1) == 0 && strcmp(p->city2, q->city2) == 0 &&
             strcmp(p->plane_num, q->plane_num) != 0)
         {
             printf("%-8s%-12s%-12s%-10s%-10s%-8.2f%-6.2f%-10d%-8d\n", p->plane_num, p->city1, p->city2, p->time1, p->time2, p->price, p->zhekou, p->plane_room,
                 p->sit);
             mark = 1;
         }
         q = q->next;
     }
     if (mark == 0)
     {
         printf("sorry,没有您要找的航班!\n");
         return 0;
     }
     return 1;


 }

int dingpiao(fly *P, customers *Q)

 {
     char name[10];
     char ID[20];
     char flight_num[10];
     char city1[20];
     char city2[20];
     int ticket_num;
     int i;
     fly *p = P->next;
     printf("请输入信息:\n");
     printf("请输入起飞城市:");
     scanf_s("%s", city1,sizeof(city1));
     printf("请输入终点城市:");
     scanf_s("%s", city2, sizeof(city2));
     if (city_chaxun(P, city1, city2) == 1)
     {
         printf("请选择航班号:\n");
         printf("航班号:");
         scanf_s("%s",flight_num,sizeof(flight_num));
         getchar();
         while (flight_num == NULL);
         {
             printf("航班号不能为空!\n");
             printf("请重新输入航班号:");
             scanf_s("%s", flight_num,sizeof(flight_num));
         }
         while (p != NULL)
         {
             if (strcmp(p->plane_num, flight_num) == 0)
             {
                 printf("请输入:\n");
                 printf("       姓名:");
                 scanf_s("%s", name,sizeof(name));
                 printf("       证件号码:");
                 scanf_s("%s", ID,sizeof(ID));
                 printf("       订票数量:");
                 scanf_s("%d", &ticket_num);
                 while (name == NULL)
                 {
                     printf("对不起,名字不能为空!\n");
                     printf("       姓名:");
                     scanf_s("%s", name,sizeof(name));
                 }
                 while (ID == NULL)
                 {
                     printf("对不起,证件号不能为空!\n");
                     printf("       证件号码:");
                     scanf_s("%s", ID,sizeof(ID));
                 }
                 while (ticket_num == 0)
                 {
                     printf("对不起,订票数量不能为0!\n");
                     printf("       订票数量:");
                     scanf_s("%d", &ticket_num);
                 }
                 if (p->plane_room > 0 && p->plane_room >= ticket_num)
                 {
                     insert_customers(P, Q, name, ID, flight_num, ticket_num);
                     printf("你应该支付 %6.2f 元\n", p->price*p->zhekou*ticket_num);
                     printf("恭喜!订票成功!\n");
                     return 1;
                 }
                 else
                 {
                     printf("sorry,该航班已满!\n");
                     printf("若选择其他航班请输入1,取消则输入0\n");
                     scanf_s("%d", &i);
                     if (i == 1)
                     {
                         if (same_plane(P, flight_num) == 1)
                         {
                             printf("请输入您选择的航班:");
                             scanf_s("%s", flight_num,sizeof(flight_num));
                             insert_customers(P, Q, name, ID, flight_num, ticket_num);
                             printf("恭喜!订票成功!\n");
                             return 1;
                         }
                     }
                 }
             }
             else
                 p = p->next;
         }
         if (p == NULL)
             printf("对不起,您输入的航班不存在!\n");
     }
     return 0;

 }
void plane_chaxun(fly *P)

 {
     fly *p = P->next;
     char plane_num[10], city1[20], city2[20];
     int a;
     printf("请选择查询方式:\n");
     printf("               1.航班号查询:\n");
     printf("               2.起飞抵达城市查询:\n");
     printf("               3.显示所有信息:\n");
     printf("请选择查询方式:");
     scanf_s("%d",&a);
     getchar();
     if (a == 1)
     {
         printf("请输入航班号:");
         scanf_s("%s", plane_num,sizeof(plane_num));
         getchar();
         num_cahxun(p, plane_num);
     }
     else if (a == 2)
     {
         printf("请输入出发地:");
         scanf_s("%s", city1,sizeof(city1));
         printf("请输入终点站:");
         scanf_s("%s", city2, sizeof(city2));
         getchar();
         city_chaxun(p, city1, city2);
     }
     else if (a == 3)
         xianshi_plane(p);
     else if (a != 1 && a != 2 && a != 3)
         return;

 }
void xiugai_plane(fly *P, customers *Q)

 {
     fly *p = P->next;
     char plane_num[10], time1[20], time2[20];
     int a;
     printf("\n*------------------------------*\n");
     printf("*-------航线信息修改:----------  *\n");
     printf("*        1. 增加航班号            *\n");
     printf("*        2. 删除航班号            *\n");
     printf("*        3. 修改起飞抵达时间      *\n");
     printf("*        4. 退出航线修改          *\n");
     printf("*------------------------------  *\n");
     printf("请选择: ");
     scanf_s("%d", &a);
     getchar();
     if (a ==1)
         creat_fly(P);
     else if (a ==2)
         delate_flight(P);
     else if (a ==3)
     {
         printf("请输入要修改的航班号:");
         scanf_s("%s", plane_num,sizeof(plane_num));
         if (num_cahxun(p, plane_num) == 1)
         {
             printf("请输入修改后的起飞时间");
             scanf_s("%s", time1,sizeof(time1));
             printf("请输入修改后的抵达时间:");
             scanf_s("%s", time2,sizeof(time2));
             while (p)
             {
                 p = p->next;
                 if (strcmp(p->plane_num, plane_num) == 0)
                 {
                     strcpy_s(p->time1, time1);
                     strcpy_s(p->time2, time2);
                     printf("修改成功!\n");
                 }
             }
         }
     }
     else if (a ==4)
     {
         return;
     }

 }
int name_id_chaxun(customers *Q, char *name, char *ID)

 {
     cus *p = Q->head->next;
     int mark = 0;
     printf("%-8s%-20s%-20s%-10s%-8s", "订单号", "姓名", "证件号码", "航班号",
         "订票数");
     while (p)
     {
         p = p->next;
         if (strcmp(p->ID, ID) == 0 && strcmp(p->name, name) == 0)
         {
             printf("%-8s%-20s%-20s%-10s%-8d\n", p->order_num, p->name, p->ID,
                 p->flight_num, p->ticket_num);
             mark = 1;
         }
     }
     if (mark == 0)
     {
         printf("sorry,没有您的订单信息!\n");
         return 0;
     }
     return 1;

 }
int order_num_chaxun(customers *Q, int order_num)

 {
     cus *p = Q->head->next;
     printf("%-8s%-20s%-20s%-10s%-8s", "订单号", "姓名", 
         "证件号码", "航班号", "订票数");
     for (; p != NULL; p = p->next)
     {
         if (p->order_num == order_num)
         {
             printf("%-8s%-20s%-20s%-10s%-8d\n", p->order_num, p->name, p->ID,
                 p->flight_num, p->ticket_num);
             return 1;
         }
     }
     printf("sorry,没有该订单信息!\n");
     return 0;

 }
void xianshi_dingdan(customers *Q)

 {
     cus *p = Q->head->next;
     int i = 0;
     printf("%-8s%-20s%-20s%-10s%-8s", "订单号", "姓名",
         "证件号码", "航班号", "订票数");
     for (; p != NULL; p = p->next)
     {
         printf("%-8s%-20s%-20s%-10s%-8d\n", p->order_num, p->name, p->ID,
             p->flight_num, p->ticket_num);
         i = 1;
     }
     if (i == 0)
         printf("当前没有订单!\n");

 }
void customer_chaxun(customers *Q)

 {
     char name[20], ID[20];
     int order_num, a;
     printf("\n*------------------------------*\n");
     printf("*-------查询方式:----------*\n");
     printf("*        1. 按客户姓名和证件号查询:     *\n");
     printf("*        2. 按订单号查询:     *\n");
     printf("*        3. 查看全部订单信息:     *\n");
     printf("*        4. 退出查询        *\n");
     printf("*------------------------------*\n");
     printf("请选择: ");
     scanf_s("%d", &a);
     if (a == 1)
     {
         printf("请输入姓名:");
         scanf_s("%s", name,sizeof(name));
         printf("请输入证件号码:");
         scanf_s("%s", ID,sizeof(ID));
         name_id_chaxun(Q, name, ID);
     }
     else if (a == 2)
     {
         printf("请输入您的订单号:");
         scanf_s("%d",&order_num);
         order_num_chaxun(Q, order_num);
     }
     else if (a == 3)
     {
         xianshi_dingdan(Q);
     }
     else if (a == 4)
         return;

 }
void tuipiao(customers *Q, fly *P)

 {
     char name[20], ID[20];
     printf("请输入姓名:");
     scanf_s("%s", name,sizeof(name));
     printf("请输入证件号码:");
     scanf_s("%s", ID,sizeof(ID));
     delate_customer(Q, P, name, ID);

 }
int menu()

 {
     int a;
     do
     {
         system("cls");
         printf("********飞机订票系统********\n");
         printf("****************************\n");
         printf("*      1. 录入信息         *\n");
         printf("*      2. 订    票         *\n");
         printf("*      3. 退    票         *\n");
         printf("*      4. 查询航班         *\n");
         printf("*      5. 查询订单         *\n");
         printf("*      6. 修改航班         *\n");
         printf("*      0. 退     出        *\n");
         printf("****************************\n");
         printf("请选择:");
         scanf_s("%d", &a);        
     } while (a<0 || a>6);
     return a;

 }
void main()

 {
     fly *P;
     customers *Q;
     P = (fly*)malloc(sizeof(fly));
     Q = (customers*)malloc(sizeof(customers));
     init_fly(P);
     init_customers(Q);
     for (;;)
     {
         switch (menu())
         {
         case 1:
             creat_fly(P);
             getchar();
             break;
         case 2:
             dingpiao(P, Q);
             getchar();
             break;
         case 3:
             tuipiao(Q, P);
             getchar();
             break;
         case 4:
             plane_chaxun(P);
             getchar();
             break;
         case 5:
             customer_chaxun(Q);
             getchar();
             break;
         case 6:
             xiugai_plane(P, Q);
             getchar();
             break;
         case 0:
             getchar();
             printf("谢谢使用!再见!\n");
             exit(0);
         }
     }

 }
试了一下每个模块都中断T_T,搞半天不知道为什么。。。。感觉思维定死了。。。。大家有什么建议或者帮忙看出问题的欢迎指出来,肯定虚心接受身体力行
搜索更多相关主题的帖子: color 
2014-08-19 14:47
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
上面是所有的代码,下面是自己遇到的一些问题,
2014-08-19 14:48
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
程序代码:
void insert_flight(fly *P, char *plane_num, char *city1, char *city2, char *time1, char *time2, int plane_room, float price, float zhekou, int sit)

 {
      fly *q;
      q = (fly*)malloc(sizeof(fly));
      strcpy_s(q->plane_num, plane_num);
      strcpy_s(q->city1, city1);
      strcpy_s(q->city2, city2);
      strcpy_s(q->time1, time1);
      strcpy_s(q->time2, time2);
      q->plane_room = plane_room;
      q->price = price;
      q->zhekou = zhekou;
      q->sit = sit;
      q->next = NULL;
      P->next = q;
      P = P->next;

 }
这个是插入数据操作,目的是在链表尾插入,可是不知道为什么只能输入一组数据,第二组输进去立马取代了第一组的数据T_T.
程序代码:
void creat_fly(fly *P)

 {
      fly *p;
      p=P;
      char plane_num[10], city1[20], city2[20], time1[20], time2[20];
      int plane_room, sit, mark = 1;
      float price, zhekou;
      if (p != NULL)
          p = p->next;
      while (mark == 1)
      {
          printf("请输入航班号:");
          scanf_s("%s", plane_num, sizeof(plane_num));
          printf("请输入出发地:");
          scanf_s("%s",city1,sizeof(city1));
          printf("请输入终点站:");
          scanf_s("%s", city2, sizeof(city2));
          printf("请输入起飞时间:");
          scanf_s("%s",time1,sizeof(time1));
          printf("请输入抵达时间:");
          scanf_s("%s",time2,sizeof(time2));
          printf("请输入票价:");
          scanf_s("%f",&price);
          printf("请输入折扣:");
          scanf_s("%f",&zhekou);
          printf("请输入座位数:");
          scanf_s("%d",&plane_room);
          printf("请输入是否满仓(0表示未满,1表示满仓):"); 
          scanf_s("%d",&sit);
          insert_flight(p, plane_num, city1, city2, time1, time2, plane_room, price, zhekou, sit);
          printf("增加航班成功!\n");
          printf("是否继续增加航班(1表示继续,0表示停止):");
          scanf_s("%d", &mark);
      }

 }
这个是调用它的地方,
2014-08-19 14:55
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
程序代码:
void insert_flight(fly *P, char *plane_num, char *city1, char *city2, char *time1, char *time2, int plane_room, float price, float zhekou, int sit)

 {
      fly *q;
      q = (fly*)malloc(sizeof(fly));
      strcpy_s(q->plane_num, plane_num);
      strcpy_s(q->city1, city1);
      strcpy_s(q->city2, city2);
      strcpy_s(q->time1, time1);
      strcpy_s(q->time2, time2);
      q->plane_room = plane_room;
      q->price = price;
      q->zhekou = zhekou;
      q->sit = sit;
      q->next = NULL;
      P->next = q;
      P = P->next;

 }
这个是插入数据操作,目的是在链表尾插入,可是不知道为什么只能输入一组数据,第二组输进去立马取代了第一组的数据T_T.
程序代码:
void creat_fly(fly *P)

 {
      fly *p;
      p=P;
      char plane_num[10], city1[20], city2[20], time1[20], time2[20];
      int plane_room, sit, mark = 1;
      float price, zhekou;
      if (p != NULL)
          p = p->next;
      while (mark == 1)
      {
          printf("请输入航班号:");
          scanf_s("%s", plane_num, sizeof(plane_num));
          printf("请输入出发地:");
          scanf_s("%s",city1,sizeof(city1));
          printf("请输入终点站:");
          scanf_s("%s", city2, sizeof(city2));
          printf("请输入起飞时间:");
          scanf_s("%s",time1,sizeof(time1));
          printf("请输入抵达时间:");
          scanf_s("%s",time2,sizeof(time2));
          printf("请输入票价:");
          scanf_s("%f",&price);
          printf("请输入折扣:");
          scanf_s("%f",&zhekou);
          printf("请输入座位数:");
          scanf_s("%d",&plane_room);
          printf("请输入是否满仓(0表示未满,1表示满仓):"); 
          scanf_s("%d",&sit);
          insert_flight(p, plane_num, city1, city2, time1, time2, plane_room, price, zhekou, sit);
          printf("增加航班成功!\n");
          printf("是否继续增加航班(1表示继续,0表示停止):");
          scanf_s("%d", &mark);
      }

 }
这个是调用它的地方,
2014-08-19 14:55
Rick_gu
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:37
专家分:108
注 册:2014-5-29
收藏
得分:3 
为什么我报这个呢
error C2198: “strcpy_s”: 用于调用的参数太少
2014-08-19 14:56
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
回复 5 楼 Rick_gu
我这个使用vs2013写的,scanf strcpy要求_s
2014-08-19 14:58
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:3 
我说的分模块调试就是  比如你有5个主菜单  每个主菜单下又设置了3个子菜单  那么你有15个子模块

你要逐一调试这15个模块 而不是把15个模块都写完了一起调试  

你比如 录入信息 模块 那你针对的代码就是录入信息这一部分,把这一部分弄到怎么测试都没有bug 之后 在去研究 什么修改 啊 查询啥的

DO IT YOURSELF !
2014-08-19 15:01
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
回复 7 楼 wp231957
单个模块怎么调试啊?可以举个例子么。。。。。有图示过程没。。。一直都是全部写完才搞的
2014-08-19 15:06
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:0 
以下是引用zycz2p在2014-8-19 15:06:27的发言:

单个模块怎么调试啊?可以举个例子么。。。。。有图示过程没。。。一直都是全部写完才搞的



简单点  你把所有代码都弄一份copy  然后再把现在的代码 涉及其他模块的都删除   把相关的菜单接口都关闭(删除或者注释掉)

调试好之后  再把相关的代码逐一的copy回来 直至所有模块全部通过测试

DO IT YOURSELF !
2014-08-19 15:08
zycz2p
Rank: 2
等 级:论坛游民
帖 子:22
专家分:10
注 册:2013-11-12
收藏
得分:0 
回复 9 楼 wp231957
没有主函数也可以调试bug么?我写的时候是这样的,比如说写完初始化的部分了,然后就点那个“本地windows调试器”,他没报错我就继续了。。。。。难倒还可以直接看出自己这部分代码的效果?
2014-08-19 15:17
快速回复:自己写的东西不知道问题出在哪里,,,,刚写完开始调试。。代码没报错 ...
数据加载中...
 
   



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

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