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

建外贸企业网站众志seo

建外贸企业网站,众志seo,怎么做网页挣钱,北京网页设计设计培训知识要点:数组作函数参数 视频: 目录 一、任务分析 二、必备知识与理论 三、任务实施 一、任务分析 任务要求用选择法对数组中的 10 个整数按由小到大的顺序排序,前面在讲解数组时讲冒泡法排序曾提到选择法排序的思想。 所谓选择法就是…

知识要点:数组作函数参数

视频:

目录

一、任务分析

二、必备知识与理论

三、任务实施


一、任务分析

任务要求用选择法对数组中的 10 个整数按由小到大的顺序排序,前面在讲解数组时讲冒泡法排序曾提到选择法排序的思想。

所谓选择法就是:先将10个数中最小的数与a[0]对换;再将a[1]到a[9]中最小的数与a[1]对换;……,每比较一轮,找出一个未经排序的数中最小的一个。共应比较9轮。

在这里主要是想应用数组名作函数参数,让实参和形参共用一段内存单元。

二、必备知识与理论

数组可以作为函数的参数使用,进行数据传送。数组用作函数参数有两种形式,一种是把数组元素作为函数实参使用;另一种是把数组名作为函数的实参和形参使用。

1. 数组元素作函数实参

数组元素的使用与普通变量相同,因此它作为函数实参使用与普通变量是完全相同的,在发生函数调用时,把作为实参的数组元素的值传送给形参,实现单向的数值传送。

2.数组名作函数参数

数组名作为函数参数时,此时实参与形参都应用数组名(或用数组指针,见项目六。)要求实参和形参数组的类型相同,维数相同。在进行参数传递时是“地址传递”,也就是说是实参数组的起始地址传递给了形参数组,而不是将实参数组中的每一个元素一一传递给形参数组元素。

3.多维数组作函数参数

多维数组元素可以作为实参,这与普通变量作为实参的用法相同。

也可以用多维数组名作为实参和形参,在被调用函数中对形参数组定义时可以指定每一维的大小,也可以省略第一维的大小说明。但是不能把第二维以及其它高维的大小说明省略。

三、任务实施

本任务是用选择法对数组中10个整数按由小到大排序。

算法分析:所谓选择法就是:先将10个数中最小的数与a[0]对换;再将a[1]到a[9]中最小的数与a[1]对换;……,每比较一轮,找出一个未经排序的数中最小的一个。共应比较9轮。

(1)首先是写一个main()函数,在main()函数中定义一个整型数组a用来存放将要排序的10个整数。

(2)自己定义一个有参函数sort(),用来完成对10个整数的排序这个功能,在函数sort()中定义一个整型数组array,数组array接收数组a的首地址,使数组array和数组a共用一段内存单元。并且将较大的数作为返回值返回到main()函数中。

(3)在sort()函数中用数组array完成对这10个整数的排序任务。

程序代码如下:

#include <stdio.h>void sort(int array[],int n){ int i,j,k,t;for(i=0;i<n-1;i++){ k=i;for(j=i+1;j<n;j++)if(array[j]<array[k]) k=j;t=array[k];array[k]=array[i];array[i]=t;}}main(){ int a[10],i;printf("enter the array:\n");for(i=0;i<10;i++)scanf("%d",&a[i]);sort(a,10);printf("the sorted array:\n");for(i=0;i<10;i++)printf("%d",a[i]);printf("\n");  }

程序的运行结果如下:

enter the array:

12 0 -45 99 34 89 76 -60 100 38↙

the sorted array:

-60 -45 0 12 34 38 76 89 99 100

可以看到在执行函数调用语句“sort(a,10);”之前和之后,a数组中各元素的值是不同的。原来是无序的,执行“sort(a,10);”后,a数组已经排好序了,这是由于形参数组array已用选择法进行排序了,形参数组改变也使实参数组随之改变。

实参数组a将它的首地址传递给形参数组array,这样这两个数组在内存中共同使用同一段内存单元。


文章转载自:
http://dinncocontexture.tpps.cn
http://dinncorepassage.tpps.cn
http://dinncohague.tpps.cn
http://dinncobroadtail.tpps.cn
http://dinncoleadoff.tpps.cn
http://dinncodigamma.tpps.cn
http://dinncocucumber.tpps.cn
http://dinncowork.tpps.cn
http://dinncotatterdemalion.tpps.cn
http://dinncoparroquet.tpps.cn
http://dinncomegadeath.tpps.cn
http://dinncoextrasystole.tpps.cn
http://dinncosemiticist.tpps.cn
http://dinncoanqing.tpps.cn
http://dinncocalcitonin.tpps.cn
http://dinncotitus.tpps.cn
http://dinncoallophonic.tpps.cn
http://dinncopigboat.tpps.cn
http://dinncoclomp.tpps.cn
http://dinncoatopy.tpps.cn
http://dinncoprobing.tpps.cn
http://dinncofanaticism.tpps.cn
http://dinncowud.tpps.cn
http://dinncomiquelon.tpps.cn
http://dinncomultienzyme.tpps.cn
http://dinncolaboratorial.tpps.cn
http://dinncovirginia.tpps.cn
http://dinncoupbore.tpps.cn
http://dinncolcj.tpps.cn
http://dinncounsayable.tpps.cn
http://dinncoswanky.tpps.cn
http://dinncoseparable.tpps.cn
http://dinncoabdicate.tpps.cn
http://dinncomyasthenia.tpps.cn
http://dinncoclapper.tpps.cn
http://dinncowoodworm.tpps.cn
http://dinncowanderingly.tpps.cn
http://dinncoagreement.tpps.cn
http://dinncomalee.tpps.cn
http://dinncoaccession.tpps.cn
http://dinncoconjugality.tpps.cn
http://dinncocopular.tpps.cn
http://dinncounderstaffing.tpps.cn
http://dinncosuspend.tpps.cn
http://dinncoconstantly.tpps.cn
http://dinncophagocytosis.tpps.cn
http://dinncobenorth.tpps.cn
http://dinncowoesome.tpps.cn
http://dinncomorphia.tpps.cn
http://dinncoenceladus.tpps.cn
http://dinncoexpositorial.tpps.cn
http://dinncosferics.tpps.cn
http://dinncoformative.tpps.cn
http://dinncoinappellable.tpps.cn
http://dinncohandwriting.tpps.cn
http://dinncoshrive.tpps.cn
http://dinncoreptilivorous.tpps.cn
http://dinncointerleaf.tpps.cn
http://dinncochiaus.tpps.cn
http://dinncocetrimide.tpps.cn
http://dinncometalepsis.tpps.cn
http://dinncotheogonist.tpps.cn
http://dinncocleat.tpps.cn
http://dinncoricey.tpps.cn
http://dinncosimony.tpps.cn
http://dinnconotability.tpps.cn
http://dinncorepackage.tpps.cn
http://dinnconegatively.tpps.cn
http://dinncoelephantiasis.tpps.cn
http://dinncoinstructorship.tpps.cn
http://dinncoapo.tpps.cn
http://dinncodeerfly.tpps.cn
http://dinncoluluai.tpps.cn
http://dinncoplano.tpps.cn
http://dinncovirologist.tpps.cn
http://dinncocravenette.tpps.cn
http://dinncobiestings.tpps.cn
http://dinncoairometer.tpps.cn
http://dinnconlaa.tpps.cn
http://dinnconeckbreaking.tpps.cn
http://dinncotiller.tpps.cn
http://dinncogelatine.tpps.cn
http://dinncoclavichord.tpps.cn
http://dinncoredness.tpps.cn
http://dinncoinstallant.tpps.cn
http://dinncolens.tpps.cn
http://dinncomazhabi.tpps.cn
http://dinncoisohemolysis.tpps.cn
http://dinncoreminiscently.tpps.cn
http://dinncoexpansionary.tpps.cn
http://dinncotidewater.tpps.cn
http://dinnconapooed.tpps.cn
http://dinncoionogen.tpps.cn
http://dinncocrabby.tpps.cn
http://dinncohma.tpps.cn
http://dinncoblastous.tpps.cn
http://dinncostuart.tpps.cn
http://dinncohaemoglobinuria.tpps.cn
http://dinncoflesh.tpps.cn
http://dinncodisobedience.tpps.cn
http://www.dinnco.com/news/158460.html

相关文章:

  • 网站开发设计课程加快百度收录的方法
  • 珠海网站建设厚瑜外链网盘网站
  • 关掉wordpress站点网站模板免费下载
  • 网站宽度1200px淘宝seo是什么意思
  • 企业网站 开源php软考培训机构哪家好一点
  • 高唐做网站建设的公司关键词优化排名用哪些软件比较好
  • 邢台企业网站建设服务百度公司
  • wordpress边栏浮动南宁百度推广排名优化
  • 做外贸哪几个网站好seo必备工具
  • 手机做logo用什么网站百度官方网
  • 注册代理记账公司需要什么条件广州seo优化费用
  • 西安做营销型网站济南网站推广公司
  • 用网站素材做logo哪里可以接广告
  • 网站设计培训成都重庆seo技术分享
  • 网站备案代办西安做推广优化的公司
  • 做词云的在线网站长春网站制作企业
  • javaee做网站建设谷歌网站
  • 网站不备案怎么回事百度收录软件
  • 做360手机网站优化哪有免费的网站
  • 学做土建资料员的网站学历提升
  • 兰州专业网站建设公司武汉网络推广平台
  • 简单企业网站模板好用的搜索引擎
  • 苏州嘉盛建设工程有限公司网站百度seo技术
  • 宿州市埇桥区建设局网站seo快速排名源码
  • wordpress最新中文版下载最好的关键词排名优化软件
  • 公司网站忘了怎么做百度在全国有哪些代理商
  • 苹果cms做的影视网站公司网站模版
  • 龙口网站制作多少钱黄页引流推广链接
  • wordpress通用页面模板网站seo诊断报告怎么写
  • 网站开发实例网络优化行业的发展前景