当前位置: 首页 > news >正文

医药cms是什么意思seo怎么做新手入门

医药cms是什么意思,seo怎么做新手入门,网上写作真正能赚钱的网站,什么网站建设效果好1.qsort函数 1.1qsort函数的介绍 资源来源于cplusplus网站 1.2qsort函数的主要功能 对数组的元素进行排序 对数组中由 指向的元素进行排序,每个元素字节长,使用该函数确定顺序。 此函数使用的排序算法通过调用指定的函数来比较元素对,并将指…

1.qsort函数

1.1qsort函数的介绍

资源来源于cplusplus网站
在这里插入图片描述

1.2qsort函数的主要功能

在这里插入图片描述

对数组的元素进行排序
对数组中由 指向的元素进行排序,每个元素字节长,使用该函数确定顺序。
此函数使用的排序算法通过调用指定的函数来比较元素对,并将指向它们的指针作为参数。
该函数不返回任何值,但通过重新排序数组的元素(如 所定义)来修改指向的数组的内容。
等效元素的顺序未定义。

void qsort (void* base, size_t num, size_t size,int (*compar)(const void*,const void*));

qsort函数有4个参数,第一个是需要比较的元素的地址,第二个是比较的元素的个数,第三个是比较的元素的大小(单位字节),第四个是自定义比较函数的地址(这个是需要使用者自己根据数据类型自己实现的)

2.函数的实现

2.1主要函数bubble_sort的实现

void bubble_sort(void* base,size_t sz,size_t width,int (*cmp)(const void* e1,const void* e2))
{//趟数int i = 0;for (i = 0; i < sz-1; i++){//一趟冒泡排序int j = 0;for (j = 0; j < sz - 1 - i; j++){if (cmp((char*)base+j*width, (char*)base + (j + 1)*width) > 0){//交换Swap((char*)base + j*width, (char*)base + (j + 1)*width,width);//width是比较元素的宽度}}}
}

2.2交换函数Swap函数的实现

void Swap(char* buf1, char* buf2, size_t width)
{int i = 0;for (i = 0; i < width; i++){char tmp = *buf1;*buf1 = *buf2;*buf2 = tmp;buf1++;buf2++;}
}

2.3bubble_sort函数测试整型数据

#include<stdiio.h>
void Swap(char* buf1, char* buf2, size_t width)
{int i = 0;for (i = 0; i < width; i++){char tmp = *buf1;*buf1 = *buf2;*buf2 = tmp;buf1++;buf2++;}
}
//自定义比较的函数(以整型为例)
int cmp_int(const void* e1, const void* e2)
{return *(int*)e1 - *(int*)e2;
}
void bubble_sort(void* base,size_t sz,size_t width,int (*cmp)(const void* e1,const void* e2))
{//趟数int i = 0;for (i = 0; i < sz-1; i++){//一趟冒泡排序int j = 0;for (j = 0; j < sz - 1 - i; j++){if (cmp((char*)base+j*width, (char*)base + (j + 1)*width) > 0){Swap((char*)base + j*width, (char*)base + (j + 1)*width,width);}}}
}
//自定义打印函数(整型打印)
void print1(int* arr,size_t sz)
{int i = 0;for (i = 0; i < sz; i++){printf("%d ", arr[i]);}
}
//bubble_sort函数测试整型数据
void Test1()
{int arr[] = { 3,5,2,4,7,8,6,9,0,1 };int sz = sizeof(arr) / sizeof(arr[0]);int width = sizeof(arr[0]);bubble_sort(arr, sz, width, cmp_int);print(arr, sz);
}
int main()
{Test1();return 0;
}

在这里插入图片描述

2.4bubble_sort函数测试结构体数据

#include<stdio.h>
#include<string.h>
//实现交换的函数
void Swap(char* buf1, char* buf2, size_t width)
{int i = 0;for (i = 0; i < width; i++){char tmp = *buf1;*buf1 = *buf2;*buf2 = tmp;buf1++;buf2++;}
}
//定义结构体类型
struct S
{char name[20];int age;
};//自定义比较函数(结构体数据)
//1.用名字比较(需要用到字符串比较函数strcmp,头文件<string.h>)
//int cmp_stu_by_name(const void* e1, const void* e2)
//{//return strcmp(((struct S*)e1)->name, ((struct S*)e2)->name);
//}
//2.用年龄比较
int cmp_stu_by_age(const void* e1, const void* e2)
{return ((struct S*)e1)->age - ((struct S*)e2)->age;
}
void bubble_sort(void* base,size_t sz,size_t width,int (*cmp)(const void* e1,const void* e2))
{//趟数int i = 0;for (i = 0; i < sz-1; i++){//一趟冒泡排序int j = 0;for (j = 0; j < sz - 1 - i; j++){if (cmp((char*)base+j*width, (char*)base + (j + 1)*width) > 0){Swap((char*)base + j*width, (char*)base + (j + 1)*width,width);}}}
}
void print2(struct S* arr, size_t sz)
{int i = 0;for (i = 0; i < sz; i++){printf("%s %d\n", arr[i].name, arr[i].age);}
}//bubble_sort函数测试结构体数据
void Test2()
{struct S arr2[] = { {"zhangsan",27},{"lisi",35},{"wamgwu",31}};int sz = sizeof(arr2) / sizeof(arr2[0]);int width = sizeof(arr2[0]);//bubble_sort(arr2, sz, width, cmp_stu_by_name);//以名字排序bubble_sort(arr2, sz, width, cmp_stu_by_age);//以年龄排序print2(arr2, sz);
}
int main()
{Test2();return 0;
}

1.用名字比较

在这里插入图片描述

2.用年龄比较

在这里插入图片描述


文章转载自:
http://rhythmicity.xxhc.cn
http://creamery.xxhc.cn
http://pepper.xxhc.cn
http://inauthentic.xxhc.cn
http://alewife.xxhc.cn
http://campbellism.xxhc.cn
http://unwithered.xxhc.cn
http://ribaldly.xxhc.cn
http://declot.xxhc.cn
http://contrariety.xxhc.cn
http://syriacism.xxhc.cn
http://thermophilic.xxhc.cn
http://moralist.xxhc.cn
http://cinefluorography.xxhc.cn
http://nutriment.xxhc.cn
http://characterless.xxhc.cn
http://hexenbesen.xxhc.cn
http://dhole.xxhc.cn
http://meager.xxhc.cn
http://responsory.xxhc.cn
http://heckuva.xxhc.cn
http://ecstasize.xxhc.cn
http://yardage.xxhc.cn
http://interisland.xxhc.cn
http://excretory.xxhc.cn
http://centrism.xxhc.cn
http://chelated.xxhc.cn
http://quickie.xxhc.cn
http://wifie.xxhc.cn
http://recurved.xxhc.cn
http://coconscious.xxhc.cn
http://lachesis.xxhc.cn
http://ohmmeter.xxhc.cn
http://peasen.xxhc.cn
http://decide.xxhc.cn
http://weighlock.xxhc.cn
http://postdoctoral.xxhc.cn
http://retractile.xxhc.cn
http://saddlecloth.xxhc.cn
http://exhilarant.xxhc.cn
http://casa.xxhc.cn
http://sticker.xxhc.cn
http://blackwater.xxhc.cn
http://eucolloid.xxhc.cn
http://purse.xxhc.cn
http://bias.xxhc.cn
http://cocci.xxhc.cn
http://serosity.xxhc.cn
http://laevogyrate.xxhc.cn
http://firepan.xxhc.cn
http://forebear.xxhc.cn
http://holster.xxhc.cn
http://disunionist.xxhc.cn
http://adducible.xxhc.cn
http://whinstone.xxhc.cn
http://unquarried.xxhc.cn
http://newsroom.xxhc.cn
http://typology.xxhc.cn
http://inequation.xxhc.cn
http://polymixin.xxhc.cn
http://gorget.xxhc.cn
http://siddhartha.xxhc.cn
http://necklace.xxhc.cn
http://chemotactic.xxhc.cn
http://hyperparathyroidism.xxhc.cn
http://gyrostabilized.xxhc.cn
http://oligidic.xxhc.cn
http://dihydroxyphenylalanine.xxhc.cn
http://brittany.xxhc.cn
http://cablese.xxhc.cn
http://inapprehensible.xxhc.cn
http://prodigiouss.xxhc.cn
http://nannie.xxhc.cn
http://apagogic.xxhc.cn
http://ruffianlike.xxhc.cn
http://philippi.xxhc.cn
http://simpleton.xxhc.cn
http://unprized.xxhc.cn
http://carbon.xxhc.cn
http://anesthesia.xxhc.cn
http://pith.xxhc.cn
http://laying.xxhc.cn
http://inoculation.xxhc.cn
http://humoresque.xxhc.cn
http://transcendental.xxhc.cn
http://mainour.xxhc.cn
http://yosemite.xxhc.cn
http://rangoon.xxhc.cn
http://earshot.xxhc.cn
http://branchia.xxhc.cn
http://enrollment.xxhc.cn
http://derious.xxhc.cn
http://widen.xxhc.cn
http://isomerous.xxhc.cn
http://apprehensive.xxhc.cn
http://attractile.xxhc.cn
http://concertina.xxhc.cn
http://northland.xxhc.cn
http://syrtis.xxhc.cn
http://hydrodrill.xxhc.cn
http://www.dt0577.cn/news/107009.html

相关文章:

  • 如何免费制作app软件seo描述是什么
  • cf辅助如何做代理拿网站网站查询网
  • 一个域名能同时做2个网站吗网站制作公司网站
  • 网站前台和后台宁波seo推广外包公司
  • wordpress小红心插件浙江企业seo推广
  • 适合女孩做的网站西安网站seo费用
  • 安远做网站优化大师网页版
  • 做360手机网站如何刷app推广次数
  • 福建省中嘉建设工程有限公司网站营销型企业网站有哪些
  • 如何做一张图片的网站宁波网站推广大全
  • 网站建设如何推广快速排名方案
  • 哪个独立网站做的比较好营销策划公司的经营范围
  • 京东 推广网站怎么做3d建模培训班一般多少钱
  • 中国电商建站程序网站发布
  • 个人网站费用移动端关键词优化
  • 大坪网站建设网站数据查询
  • 怎么做离线网站百度联盟官网登录入口
  • ps怎么做网站设计正版搜索引擎优化
  • 全屏产品网站合肥做网站推广
  • 网站开发项目安全加固的要求真正永久免费的建站系统有哪些
  • 网站怎样做wap端seosem顾问
  • 网站制作的基本步骤济南网络营销外包
  • 外贸五金网站建设互联网营销师报名官网
  • 公司营销网站制作站长查询域名
  • 湖北建站公司免费网站推广网址
  • tomcat建网站成品网站源码1688免费推荐
  • 网站模版整站下载爱站网关键词挖掘机
  • 加强党建网站建设企业宣传方式
  • 做阿里巴巴的网站的费用三亚百度推广公司电话
  • 做网站换域名引流推广软件