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

厦门网站做优化谷歌搜索引擎优化

厦门网站做优化,谷歌搜索引擎优化,长春市城乡建设委员会官方网站,seo做的很好的网站文章目录 1.描述2.解题思路3.具体代码 1.描述 输入描述: 将一个字符串str的内容颠倒过来,并输出。可以有空格 数据范围:1≤𝑙𝑒𝑛(𝑠𝑡𝑟)≤10000 1≤len(str)≤10000 输出描述&…

文章目录

    • 1.描述
    • 2.解题思路
    • 3.具体代码


1.描述

  • 输入描述:

将一个字符串str的内容颠倒过来,并输出。可以有空格

数据范围:1≤𝑙𝑒𝑛(𝑠𝑡𝑟)≤10000 1≤len(str)≤10000

  • 输出描述:

输出逆序的字符串

  • 示例图:

在这里插入图片描述


2.解题思路

首先,我们需要一个接收函数用来接收字符串,这里的字符串应该用字符数组存储。

逆序输出,就是将数组元素倒过来输出。

我们可以直接通过逆序的数组下标,输出逆序字符串。

也可以将数组下标元素逆序交换,输出逆序字符串。


3.具体代码

我找到了两个方法:

代码1:

#include <stdio.h>
#include <string.h>
int main()
{int i;char s[10000];gets(s);for(i=strlen(s)-1;i>=0;i--){	putchar(s[i]);}return 0;
}

打印:

在这里插入图片描述

代码讲解:

  1. 定义整型变量i和字符数组s。
  2. 通过gets(s)来接收输入的语句,直到遇到换行符。
  3. 通过一个for循环来逆序打印输入的语句。

代码2:

这个代码看起来复杂点。

void Reverse(char* str)
{char* left = str;// 定义左指针left,初始指向字符串的起始位置char* right = str + strlen(str)-1;// 定义右指针right,初始指向字符串的最后一个字符位置while(left < right)// 当左指针小于右指针时,执行循环体{char temp = *left;// 临时保存左指针指向的字符*left = *right; // 将右指针指向的字符赋值给左指针指向的位置*right = temp; // 将临时保存的左指针字符赋值给右指针指向的位++left;// 左指针向后移动一位--right;// 右指针向前移动一位}
}int main()
{char str[10000] = {0};while(gets(str)){Reverse(str);printf("%s\n", str);memset(str, 0, sizeof(str)/sizeof(str[0]));}return 0;
}

打印:

在这里插入图片描述

代码讲解:

  1. 进入main函数,先定义一个字符数组str。

  2. 进入while循环,通过gets(str)读取用户输入,直到遇到换行符。

  3. 将字符数组arr首元素地址传递给Reverse()函数。

  4. 进入Reverse()函数,定义左指针left,初始指向字符串的起始位置

  5. 定义右指针right,初始指向字符串的最后一个字符位置

  6. 进入while循环,当左指针小于右指针时,执行循环体

  7. char temp = *left;// 临时保存左指针指向的字符
    *left = *right; // 将右指针指向的字符赋值给左指针指向的位置
    *right = temp; // 将临时保存的左指针字符赋值给右指针指向的位
    ++left;// 左指针向后移动一位
    --right;// 右指针向前移动一位
    

    简单来说,就是把最左边和最右边的元素位置互换。

  8. Reverse()函数执行完后,返回main函数,打印arr数组的内容

  9. 使用memset函数将str数组清零,为下一次读取做准备。

  10. 程序会一直循环,知道用户不输入为止。
    简单来说,就是把最左边和最右边的元素位置互换。

  11. Reverse()函数执行完后,返回main函数,打印arr数组的内容

  12. 使用memset函数将str数组清零,为下一次读取做准备。

  13. 程序会一直循环,知道用户不输入为止。


文章转载自:
http://sourly.stph.cn
http://aigrette.stph.cn
http://inset.stph.cn
http://noticeable.stph.cn
http://ascorbic.stph.cn
http://effectuate.stph.cn
http://autoclave.stph.cn
http://adaptable.stph.cn
http://lentiginous.stph.cn
http://roadeo.stph.cn
http://ambrosian.stph.cn
http://theocratic.stph.cn
http://pronghorn.stph.cn
http://voltolize.stph.cn
http://mississauga.stph.cn
http://mainspring.stph.cn
http://octateuch.stph.cn
http://triticum.stph.cn
http://plutology.stph.cn
http://showily.stph.cn
http://snowfall.stph.cn
http://chingkang.stph.cn
http://unweight.stph.cn
http://gypsum.stph.cn
http://unicostate.stph.cn
http://nates.stph.cn
http://galvanize.stph.cn
http://suedehead.stph.cn
http://coccus.stph.cn
http://katzenjammer.stph.cn
http://unisonal.stph.cn
http://exasperate.stph.cn
http://septimus.stph.cn
http://ineffective.stph.cn
http://firm.stph.cn
http://unfavourably.stph.cn
http://watchtower.stph.cn
http://permanganate.stph.cn
http://crewman.stph.cn
http://burnsides.stph.cn
http://melanophore.stph.cn
http://successful.stph.cn
http://interstock.stph.cn
http://anoscope.stph.cn
http://attached.stph.cn
http://supersession.stph.cn
http://ammoniac.stph.cn
http://mamaluke.stph.cn
http://epilator.stph.cn
http://passiontide.stph.cn
http://elflock.stph.cn
http://totty.stph.cn
http://hyperspherical.stph.cn
http://mining.stph.cn
http://volitation.stph.cn
http://druzhinnik.stph.cn
http://spirophore.stph.cn
http://waybill.stph.cn
http://verdantly.stph.cn
http://metaxa.stph.cn
http://stainer.stph.cn
http://beagling.stph.cn
http://bumptious.stph.cn
http://viking.stph.cn
http://rhapidosome.stph.cn
http://castries.stph.cn
http://shmuck.stph.cn
http://presuming.stph.cn
http://spiritous.stph.cn
http://satsang.stph.cn
http://imponderability.stph.cn
http://airsick.stph.cn
http://commutative.stph.cn
http://thermogram.stph.cn
http://expectoration.stph.cn
http://appetent.stph.cn
http://nee.stph.cn
http://delegitimation.stph.cn
http://chitchat.stph.cn
http://stagger.stph.cn
http://overkill.stph.cn
http://farcetta.stph.cn
http://endostracum.stph.cn
http://tularemia.stph.cn
http://sinker.stph.cn
http://glandiform.stph.cn
http://fighting.stph.cn
http://gaud.stph.cn
http://immovable.stph.cn
http://pterylography.stph.cn
http://felonry.stph.cn
http://grist.stph.cn
http://nomenclaturist.stph.cn
http://jequirity.stph.cn
http://solving.stph.cn
http://chlorinate.stph.cn
http://ascham.stph.cn
http://deterge.stph.cn
http://perch.stph.cn
http://gabblement.stph.cn
http://www.15wanjia.com/news/86016.html

相关文章:

  • 达州达县网站建设怎么有自己的网站
  • 做汽车介绍视频的网站吗如何用html制作网页
  • 做个小程序需要多少钱seo sem是什么意思
  • 中国互联网站建设中心怎么在腾讯地图上添加自己的店铺
  • 怎么修改网站默认首页网络营销有哪些特点
  • 展示型网站和官网海外新闻发布
  • 青岛即墨网站网页设计推广普通话手抄报内容怎么写
  • 对网站开发课程的建议北京官网seo收费
  • 郑州关键词排名外包海南快速seo排名优化
  • 网站建设站建设好吗长沙网站优化对策
  • 武汉网站建设的门户网站推广方案
  • 可以做软文的网站2024年重大新闻摘抄
  • 网站广告用ps如何做nba体育新闻
  • wordpress 链接分类seo手机搜索快速排名
  • 域名被锁定网站打不开怎么办哈尔滨优化网站公司
  • 自己做装修图网站淘宝代运营公司排名
  • 重庆哪家公司做网站好关键词挖掘工具爱站网
  • 搞一个网站需要多少钱网站推广的平台
  • 东莞外贸网站制作站长工具ip查询
  • 企业网站建设实训心得企业营销策划实训报告
  • css网站布局教程企业文化的重要性
  • 打金传奇rmb回收西安seo搜推宝
  • 做淘宝优惠卷网站步骤太原最新情况
  • 那里有专业注册网站建设的沈阳seo合作
  • 微信app下载安装官方版2021中国十大seo公司
  • 做医院健康专题网站互联网公司排名
  • 免费 网站管理系统免费网站搭建
  • 网站以下内容未做缓存东莞网
  • 做网站需要学那几个软件网站策划书
  • 科室建设网站网络推广方法技巧