首页 > 学院 > 开发设计 > 正文

C的数据库编程(2)

2019-11-17 05:40:38
字体:
来源:转载
供稿:网友
  if (found_num != 0)
      PRintf("find %d/n",found_num);
  else
      printf("no record/n");
     }
     else
  printf("out record/n");
     break;
 case 7:
     printf("/n");
     printf("force:");
     scanf("%d",&find_force);
     if (head != nil) {
  c = head;
  l = c->next;
  found_num = 0;
  output_title();
  for (i = 1; i <= count; i++) {
      if (c->force == find_force) {
   output_it(c,i);
   found_num = found_num + 1;
   c = l;
   l = c->next;
      }
      else  {
   c = l;
   l = c->next;
      }    /*IF*/
  }    /*FOR*/
  if (found_num != 0)
      printf("find %d/n",found_num);
  else
      printf("no record/n");
     }
     else
  printf("out record/n");
     break;
 case 8:
     printf("/n");
     printf("smartness:");
     scanf("%d",&find_smartness);
     if (head != nil) {
  c = head;
  l = c->next;
                found_num = 0;
                output_title();
                for (i = 1; i <= count; i++) {
      if (c->smartness == find_smartness) {
   output_it(c,i);
                        found_num = found_num + 1;
   c = l;
   l = c->next;
      }
      else  {
   c = l;
   l = c->next;
      }    /*IF*/
  }    /*FOR*/
  if (found_num != 0)
      printf("find %d/n",found_num);
  else
      printf("no record/n");
     }
            else
  printf("out record/n");
     break;
 default:
     printf("find error/n");
     break;
    }    /*CASE*/
}void sort_record (void)
{int condition_code;
int i,
    j;int long_c,long_f;
strUCt node *c_bak,
     *l_bak;    condition_code = condition_select("sort condition:");
    switch (condition_code) {
 case 1:
     printf("record over/n");
     break;
 case 2:
     if ((head != nil) && (head->next != nil)) {
  c_bak = current;
  l_bak = last;    /*沉淀法排序*/
  for (i = count - 1; i >= 1; i--) {
      current = c_bak;
      last = l_bak;
      for (j = 1; j <= i; j++) {
   if (current->number < current->front->number)
       swap_it(&current,&last,&c_bak,&l_bak);
                        current = current->front;
   last = current->next;
                    }
                }
                current = c_bak;
                last = l_bak;
     }
     printf("no over/n");
     break;
        case 3:
            if ((head != nil) && (head->next != nil)) {
                c_bak = current;
                l_bak = last;    /*沉淀法排序*/
                for (i = count - 1; i >= 1; i--) {
                    current = c_bak;
                    last = l_bak;
                    for (j = 1; j <= i; j++) {
                        if (strcmp(current->name,
    current->front->name) < 0)
                            swap_it(&current,&last,&c_bak,&l_bak);
                        current = current->front;
   last = current->next;
                    }
                }
                current = c_bak;
                last = l_bak;
            }
     printf("name over/n");
            break;
        case 4:
     if ((head != nil) && (head->next != nil)) {
                c_bak = current;
                l_bak = last;    /*沉淀法排序*/
                for (i = count - 1; i >= 1; i--) {
                    current = c_bak;
    &nbs


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表