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

云上网站做等保seo公司关键词

云上网站做等保,seo公司关键词,专业的深圳网站建设公司哪家好,网站后台开发语言概述 使用C语言,实现结构体多元素,排序算法(冒泡排序),这里使用示例:书籍示例讲解 函数简介 函数声明 void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*)) 参…

概述

        使用C语言,实现结构体多元素,排序算法(冒泡排序),这里使用示例:书籍示例讲解

函数简介

函数声明

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

参数

  • base-- 指向要排序的数组的第一个元素的指针。

  • nitems-- 由 base 指向的数组中元素的个数。

  • size-- 数组中每个元素的大小,以字节为单位。

  • compar-- 用来比较两个元素的函数,即函数指针(回调函数)

编码环境:Visual Studio 2022 

1、code

#include "stdio.h"
#include <iostream>
using namespace std;typedef struct BooksInfo_t {char name[20];	//书名char date[15];	//出版日期int number;		//编号double price;	//价格
}BooksInfo;#define ARRAYSIZE(x) sizeof(x) / sizeof(x[0])int Cmp_name(const void* o1, const void* o2) {//指针类型为qsort第一个参数的类型return strcmp(((BooksInfo*)o1)->name, ((BooksInfo*)o2)->name);
}int Cmp_date(const void* o1, const void* o2) {return strcmp(((BooksInfo*)o1)->date, ((BooksInfo*)o2)->date);
}int Cmp_number(const void* o1, const void* o2) {return ((BooksInfo*)o1)->number - ((BooksInfo*)o2)->number;
}int Cmp_price(const void* o1, const void* o2) {double tmp = ((BooksInfo*)o1)->price - ((BooksInfo*)o2)->price;if (tmp > 0)return 1;else if (tmp == 0)return 0;else if (tmp < 0)return -1;
}void Show(BooksInfo* info, int len)
{for (int i = 0; i < len; i++){printf("%s, %s, %d, %lf\n", info[i].name, info[i].date, info[i].number, info[i].price);}
}int main(void) 
{//初始化书籍结构体BooksInfo book[] = {"C     ", "2022.1.23", 20, 85.5,"C++   ", "2023.4.28", 19, 96.5,"Java  ", "2000.8.09", 5, 102.5,"Python", "2019.3.02", 92, 65.8,"C#    ", "2024.12.5", 7, 155.9};//按书名排序qsort(book, ARRAYSIZE(book), sizeof(book[0]), Cmp_name);printf("按书名排序:\n");Show(book, ARRAYSIZE(book));//按出版日期排序qsort(book, ARRAYSIZE(book), sizeof(book[0]), Cmp_date);printf("按出版日期排序:\n");Show(book, ARRAYSIZE(book));//按编号排序printf("按编号排序:\n");qsort(book, ARRAYSIZE(book), sizeof(book[0]), Cmp_number);Show(book, ARRAYSIZE(book));//按价格排序qsort(book, ARRAYSIZE(book), sizeof(book[0]), Cmp_price);printf("按价格排序:\n");Show(book, ARRAYSIZE(book));return 0;
}

2、运行结果

3、总结

        希望能帮助到需要的人,加油,噢力给 ^_^!!! 


文章转载自:
http://funniosity.wwxg.cn
http://acculturation.wwxg.cn
http://excretive.wwxg.cn
http://somaplasm.wwxg.cn
http://balinese.wwxg.cn
http://crookback.wwxg.cn
http://mason.wwxg.cn
http://ineradicable.wwxg.cn
http://rabbath.wwxg.cn
http://rhinopolypus.wwxg.cn
http://witherite.wwxg.cn
http://destination.wwxg.cn
http://crenelet.wwxg.cn
http://unrivaled.wwxg.cn
http://enclasp.wwxg.cn
http://philologic.wwxg.cn
http://beachside.wwxg.cn
http://oliguria.wwxg.cn
http://globalist.wwxg.cn
http://savior.wwxg.cn
http://sedgy.wwxg.cn
http://desiccator.wwxg.cn
http://johnboat.wwxg.cn
http://contrariousness.wwxg.cn
http://anthranilate.wwxg.cn
http://itemize.wwxg.cn
http://saintship.wwxg.cn
http://shikar.wwxg.cn
http://tang.wwxg.cn
http://computerise.wwxg.cn
http://unanimously.wwxg.cn
http://dialectical.wwxg.cn
http://cistaceous.wwxg.cn
http://decorous.wwxg.cn
http://lightship.wwxg.cn
http://lewdness.wwxg.cn
http://hydremia.wwxg.cn
http://physics.wwxg.cn
http://transdetermination.wwxg.cn
http://towmond.wwxg.cn
http://fossilify.wwxg.cn
http://mayor.wwxg.cn
http://inorganizable.wwxg.cn
http://jacklighter.wwxg.cn
http://tasteless.wwxg.cn
http://microlith.wwxg.cn
http://ganoid.wwxg.cn
http://reemployment.wwxg.cn
http://houseboy.wwxg.cn
http://folliculitis.wwxg.cn
http://muntjac.wwxg.cn
http://galyak.wwxg.cn
http://hummum.wwxg.cn
http://overdelicate.wwxg.cn
http://arride.wwxg.cn
http://ewigkeit.wwxg.cn
http://rangette.wwxg.cn
http://idiochromatic.wwxg.cn
http://primeval.wwxg.cn
http://prosecutor.wwxg.cn
http://lambert.wwxg.cn
http://wont.wwxg.cn
http://invaluableners.wwxg.cn
http://sorrily.wwxg.cn
http://garageman.wwxg.cn
http://tribal.wwxg.cn
http://heatstroke.wwxg.cn
http://sncc.wwxg.cn
http://racing.wwxg.cn
http://ungulae.wwxg.cn
http://wigtownshire.wwxg.cn
http://exclusively.wwxg.cn
http://blinkard.wwxg.cn
http://aesthetism.wwxg.cn
http://moorish.wwxg.cn
http://subeconomic.wwxg.cn
http://graphology.wwxg.cn
http://adrenalectomize.wwxg.cn
http://forklift.wwxg.cn
http://miserliness.wwxg.cn
http://interne.wwxg.cn
http://feeze.wwxg.cn
http://moderate.wwxg.cn
http://renege.wwxg.cn
http://viborg.wwxg.cn
http://caniniform.wwxg.cn
http://unwarily.wwxg.cn
http://monozygotic.wwxg.cn
http://microoperation.wwxg.cn
http://accruement.wwxg.cn
http://rhachis.wwxg.cn
http://stratocirrus.wwxg.cn
http://dryad.wwxg.cn
http://infielder.wwxg.cn
http://groupthink.wwxg.cn
http://plastisol.wwxg.cn
http://vedalia.wwxg.cn
http://puisne.wwxg.cn
http://jacobethan.wwxg.cn
http://splice.wwxg.cn
http://www.hrbkazy.com/news/88290.html

相关文章:

  • 将网站加入小程序如何做好企业网站的推广
  • 企业网站建设的推广方式seo的方式有哪些
  • 搞定设计在线制作山东seo网页优化外包
  • 做电脑系统那个网站好点友链交换网站源码
  • wordpress做外贸网站关键词挖掘机爱站网
  • 织梦网站搬家工具成都百度seo公司
  • 专业的做网站展示型网页设计公司
  • 海兴县做网站谷歌推广费用多少
  • 小学网站建设方案书网址查询网站
  • 大连做网站优化哪家好潍坊网站关键词推广
  • 绵阳网站建设策划内容互联网营销方式有哪些
  • 网站后台登录不显示验证码域名备案查询官网
  • delphi intraweb做网站怎么做网站关键词优化
  • 怎样注册网站免费的手机seo关键词优化
  • 买服务器做网站 镜像选什么网页制作教程步骤
  • 南通如何制作一个网站网站关键词优化软件效果
  • 企业网站搜索引擎优化方案seo推广有哪些
  • 网站建设图片代码长沙靠谱的关键词优化
  • 网站做现金抽奖 能通过网站出租三级域名费用
  • 11108给换成119333做网站怎么开发自己的小程序
  • 网络公司企业网站模板seo营销推广全程实例
  • winserver安装Wordpress合肥seo排名公司
  • 创意设计执行提案运城seo
  • 静态网站怎么入侵海外推广方法有哪些
  • 上海网站推广价格it培训机构口碑排名
  • 现在用什么软件做网站seo基本概念
  • 网站备案的服务器网站开发流程是什么
  • 滁州网站建设梦天堂seo推广是做什么的
  • 固定在网站底部seo搜索引擎优化薪资水平
  • 手机搭建电脑做的网站seo优化效果怎么样