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

jsp网站开发技巧网站注册搜索引擎的目的是

jsp网站开发技巧,网站注册搜索引擎的目的是,网站错误代码301,虚拟主机商废话不多说#xff0c;数据结构自己写代码见识了太多的bug#xff0c;看来还是自己写代码的功夫不到家啊#xff0c;进入正题。直接上代码。 #include stdio.h #include stdlib.h #define MAXSIZE 100 #define ERROR 0 #define OK 1 typedef int ElemType;…废话不多说数据结构自己写代码见识了太多的bug看来还是自己写代码的功夫不到家啊进入正题。直接上代码。 #include stdio.h #include stdlib.h #define MAXSIZE 100 #define ERROR 0 #define OK 1 typedef int ElemType; typedef struct {ElemType *elem;int length; }SqList; //算法2.3 构造一个空的线性表 bool InitList_Sq(SqList L) {L.elemnew ElemType[MAXSIZE];if(!L.elem)return false;L.length0;return true; } //给顺序表赋值 void Set_SqList(SqList L) {int num;int i-1;printf(Please enter some numbers,then enter 9999 to end.\n);while (scanf(%d,num)){if(num9999)break;L.elem[i]num;L.length;}printf(Successfully set SqList.\n);printf(Your SqList is:\n);for(int i0;iL.length;i)printf(%d ,L.elem[i]);printf(\n); } //算法2.4 ElemType ListInsert_Sq(SqList L, int i, ElemType e) { // 在顺序线性表L的第i个位置之前插入新的元素e// i的合法值为1iListLength_Sq(L) 1if(i1 || iL.length1) return ERROR; if(L.lengthMAXSIZE) return ERROR;for(int jL.length-1;ji-1;j--) L.elem[j1]L.elem[j];L.elem[i-1]e;L.length;return OK; } // 算法2.5 ElemType ListDelete_Sq(SqList L,int i,ElemType e) { // 在顺序线性表L中删除第i个元素, 并用e返回其值// i的合法值为1iListLength_Sq(L)if((i1)||(iL.length))return ERROR;eL.elem[i-1];for(int ji;jL.length;j){L.elem[j-1]L.elem[j];}--L.length;return OK; }//算法 找Max ElemType FindMax(SqList L) {int MaxL.elem[0];for(int i0;iL.length;i){if(L.elem[i]Max)MaxL.elem[i];}return Max; } //算法 找Min ElemType FindMin(SqList L) {int MinL.elem[0];for(int i0;iL.length;i){if(L.elem[i]Min){MinL.elem[i];} }return Min; } //算法 删除所有值大于min而且小于max的元素 void DeleteNumbers(SqList L,ElemType Max,ElemType Min) {ElemType element;int k0;while(kL.length-1){ //当kL.length-1时说明删完了if(L.elem[k]Min L.elem[k]Max){ListDelete_Sq(L,k1,element); //K是数组下标而删除的是以1开头的下标所以加1}else{k;}}for(int i0;iL.length;i)printf(%d ,L.elem[i]);printf(\n); } int main() {SqList L; //构造一个线性表ElemType ret;retInitList_Sq(L); //构造一个空的线性表,并把返回值给retif(ret){printf(Successfully initialized SqList.\n);}elseprintf(Failed initialized SqList.\n); Set_SqList(L); //给表赋值printf(What a number do you want to insert?\n);int number;scanf(%d,number);printf(Where do you want to insert it?\n);int position;scanf(%d,position);retListInsert_Sq(L,position,number);if(ret){printf(Successfully insert SqList.\n);printf(After inserting,your SqList is:\n);for(int i0;iL.length;i)printf(%d ,L.elem[i]);printf(\n);}elseprintf(Failed insert SqList.\n);printf(Which element in the SqList do you want to delete?\n);int position2;scanf(%d,position2);ElemType element;retListDelete_Sq(L,position2,element);if(ret){printf(Successfully delete SqList.\n);printf(The element you delete is: %d\n,element);printf(After deletting,your SqList is:\n);for(int i0;iL.length;i)printf(%d ,L.elem[i]);printf(\n); }elseprintf(Failed delete SqList.\n);ElemType MaxFindMax(L); //最大值printf(The max number is: %d\n,Max);ElemType MinFindMin(L); //最小值printf(The min number is: %d\n,Min);printf(After delete the numbers between min and max,then the SqList is:\n);DeleteNumbers(L,Max,Min);return 0;/*Sample Input0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0*/ } 输出  Successfully initialized SqList. Please enter some numbers,then enter 9999 to end. 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 9999 Successfully set SqList. Your SqList is: 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 What a number do you want to insert? 9999 Where do you want to insert it? 1 Successfully insert SqList. After inserting,your SqList is: 9999 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 Which element in the SqList do you want to delete? 1 Successfully delete SqList. The element you delete is: 9999 After deletting,your SqList is: 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 0 The max number is: 5 The min number is: 0 After delete the numbers between min and max,then the SqList is: 0 5 0 5 0-------------------------------- Process exited after 14.98 seconds with return value 0 请按任意键继续. . . 让我折腾了不少时间的bug就是——删除所有值大于min而且小于max的元素  的实现。删除顺序表中的元素直接调用ListDelete_Sq()函数既然是删除所有值大于min而且小于max的元素那就需要遍历出所有值大于min而且小于max的元素。既然是遍历自然会想到用for循环了用for循环时删除算法执行后应该 i--;因为删除元素后后面的元素移动到当前位置来了需要再次判是否符合删除条件如果符合i才能。也可以用while()循环while循环的做法需要增加一条语句if   else   。if()里面的条件成立执行删除算法。如果不成立下标i需要。 还有一点需要注意的是循环的终止条件是什么中止条件就是当下标1Length后才能中止不能是大于等于可能会漏掉最后一个不符合条件的数。 还有一点就是删除所有值大于min而且小于max的元素的判断条件应该怎么写。应该是 L.elem[k]Min L.elem[k]Max 或者 L.elem[k]!Min L.elem[k]!Max 不能用或——||
http://www.zqtcl.cn/news/987948/

相关文章:

  • 网站备案 营业执照做企业网站注意些啥
  • 网站建设公司济南网络教学平台昆明理工大学
  • 原网站开发新功能世赛网站开发
  • 做一款小程序需要多少钱凡科的网站做seo比较难
  • 北京网页设计与网站建设最专业的手机网站建设
  • 做一个网站广州网站备案拍照
  • 做平面图片的网站wordpress批量添加连接
  • 做ppt哪些网站的图片质量高做电商网站需要多少时间
  • 个人网站模板源码wordpress流动公告
  • html5 手机 网站盘锦建设工程信息网站
  • 高端企业网站定制公司wordpress喜欢_赏_分享
  • 网站开发推广方案策划书开发公司移交给物业资料说明
  • 做响应式网站的菜单中国造价网官网
  • 爱心捐赠网站怎么做中国机械网官网
  • 好的ftp网站微信小程序开发基础
  • 西安 网站 公司wordpress+帖子置顶
  • 广州开发网站服务上海千途网站建设
  • 网站建设功能分为几种百度搜索数据
  • 电影网站模板html微信开发者代码管理
  • 小程序ui界面设计手机优化大师官网
  • 佳木斯市建设局网站网络游戏名
  • 建筑钢结构网站汉阳网站建设哪家便宜
  • 营销型网站建设评价临湘网站建设
  • 做网站的价格参考巴中建网站的公司
  • 张家口建设网站网络技术工程师
  • 大型网站后台登录地址一般是如何设置的哪里网站用vue.js做的
  • 网页设计规范图标设计百度seo优化多少钱
  • 网站打开速度概念建筑网站知乎
  • 网站的flash怎么做的杭州市城乡建设网官网
  • 宿迁网站建设排名wordpress多站点可视化