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

骆诗网站建设如何做推广宣传

骆诗网站建设,如何做推广宣传,企业门户网站制作价格怎么算,个人网站设计报告书🐶博主主页:ᰔᩚ. 一怀明月ꦿ ❤️‍🔥专栏系列:线性代数,C初学者入门训练 🔥座右铭:“不要等到什么都没有了,才下定决心去做” 🚀🚀🚀大家觉不错…

🐶博主主页:@ᰔᩚ. 一怀明月ꦿ 

❤️‍🔥专栏系列:线性代数,C初学者入门训练

🔥座右铭:“不要等到什么都没有了,才下定决心去做”

🚀🚀🚀大家觉不错的话,就恳求大家点点关注,点点小爱心,指点指点🚀🚀🚀 

目录

🐰inline 函数

🐰string类

🌸1.字符串的定义:

🌸2.访问字符串

🌸3.字符串的连接

🌸4.字符串的比较

🌸5.字符串长度的计算

🌸6.字符串的交换

🌸7.字符串数组

🐰static_cast强制类型转化


🐰inline 函数

inline 函数由inline关键字定义,引入inline函数的主要原因是用它替代C中复杂不易维护的宏函数

编译器在编译阶段完成对 inline 函数的处理,即对 inline 函数的调用替换为函数的本体。但 inline 关键字对编译器只是一种建议,编译器可以这样去做,也可以不去做。从逻辑上来说,编译器对 inline 函数的处理步骤一般如下:

(1)将 inline 函数体复制到inline函数调用处;

(2)为所用 inline 函数中的局部变量分配内存空间;

(3)将 inline 函数的的输入参数和返回值映射到调用方法的局部变量空间中;

(4)如果 inline 函数有多个返回点,将其转变为 inline 函数代码块末尾的分支(使用goto)。

事例(求0~9的平方和):
inline int inlineFunc(int num) {  if(num>9||num<0) return -1;  return num*num;  
}  int main(int argc,char* argv[]) {int a=8;int res=inlineFunc(a);cout<<"res:"<<res<<endl;
}
inline 之后的main()函数代码类似于如下形式:
int main(int argc,char* argv[]) {int a = 8; {  int _temp_b=8;  int _temp;  if (_temp_q >9||_temp_q<0) _temp = -1;  else _temp =_temp*_temp;  b = _temp;  }
}
使用inline能够使程序运行速度更加快,但是代码空间似乎增大了,就是实现空间换取时间
使用方法:
函数定义时,在返回类型前加上关键字 inline 即把函数指定为内联,函数申明时可加也可不加。但是建议函数申明的时候,也加上 inline,这样能够达到"代码即注释"的作用。
关键字 inline 必须与函数定义体放在一起才能使函数成为内联,仅将 inline 放在函数声明前面不起任何作用。
如下风格的函数 Fun 不能成为内联函数:
inline int Fun(int x, int y);      inline 仅与函数声明放在一起
int Fun(int x, int y){ } 

而如下风格的函数 Fun 则成为内联函数:

int Fun(int x, int y);
inline int Fun(int x, int y) { } 

inline 与函数定义体放在一起,inline 是一种"用于实现的关键字",而不是一种"用于声明的关键字"。

🐰string类

string类是一种顺序表的结构,元素是char类型的字符

🌸1.字符串的定义:

string类的常用构造函数:

string  str——构造空的string类对象,即空字符串

string str(str1)——str1 和 str 一样

string  str("ABC")——等价于 str="ABC"

string  str("ABC",strlen)——等价于 "ABC" 存入 str 中,最多存储 strlen 个字节

string  str("ABC",stridx,strlen)——等价于 "ABC" 的stridx 位置,作为存到str字符串开头,中,最多存储 strlen 个字节

string  str(srelen,'A')——存储 strlen 个 'A' 到 str 中

🌸2.访问字符串

#include<iostream>
using namespace std;
string str=" abc”;和字符数组一样,字符串可以直接用下标进行访问
char ch=str[0];
cout<<ch<<endl;

🌸3.字符串的连接

字符串string a=“abcd”,string b=“efgh”,string c;
连接a和b赋值给字符串c只需要c=a+b.

🌸4.字符串的比较

(1) 当s1 < s2时,返回负数;

(2) 当s1 == s2时,返回值 = 0;

(3) 当s1 > s2时,返回正数。

即:两个字符串自左向右逐个字符相比(按ASCII值大小相比较),直到出现不同的字符或遇’\0’为止。如:

“A”<”B”

“a”>”A”

“computer”>”compare”

事例(比较字符串的大小):
#include<iostream>
using namespace std;
int main()
{string arr="abcd";string brr(arr,0);cout<<brr<<"\n";if(arr>brr){cout<<"大于"<<"\n";}else if(arr<brr){cout<<"小于"<<"\n";}else{cout<<"等于"<<"\n";}return 0;
}
结果:
abcd
等于

🌸5.字符串长度的计算

str.length()——求字符串长度
str.size()——和 length() 一样string arr="abcd";
string brr(arr,0);
cout<<arr.length()<<"\n";
cout<<arr.size()<<"\n";

🌸6.字符串的交换

这三种都可以 交换 arr 和 brr 的字符串
arr.swap(brr)        
arr.swap(brr);
brr.swap(arr);

🌸7.字符串数组

不仅可以用string定义字符串变量,也可以用string定义字符串数组。
如:string name[5]; 
定义一个字符串数组,它包含5个字符串元素
string name[5]={″Zhang″,″Li″,″Fun″,″Wang″,″Tan″};
字符数组的注意事项
1.在一个字符串数组中包含若干个(现为5个)元素,每个元素相当于一个字符串变量。
2.并不要求每个字符串元素具有相同的长度,即使对同一个元素而言,它的长度也是可以变化的,当向某一个元素重新赋值,其长度就可能发生变化。
3.在字符串数组的每一个元素中存放一个字符串,而不是一个字符,这是字符串数组与字符数组的区别。如果用字符数组存放字符串,一个元素只能存放一个字符,用一个一维字符数组存放一个字符串。
4.每一个字符串元素中只包含字符串本身的字符而不包括′\0′。

🐰static_cast强制类型转化

static_cast用于非多态类型的转换(静态转换),编译器隐式执行的任何类型转换都可用
static_cast,但它不能用于两个不相关的类型进行转换
 int c=static_cast<int>(a);int d=static_cast<int>(b);
编译报错 两个不相关的类型就不能进行类型转换int* e=static_cast<int*>(&b);

  🌸🌸🌸如果大家还有不懂或者建议都可以发在评论区,我们共同探讨,共同学习,共同进步。谢谢大家! 🌸🌸🌸  


文章转载自:
http://dinncosybase.bkqw.cn
http://dinncointrada.bkqw.cn
http://dinncomulish.bkqw.cn
http://dinncospool.bkqw.cn
http://dinncoheah.bkqw.cn
http://dinncoburthen.bkqw.cn
http://dinncotrine.bkqw.cn
http://dinncochamorro.bkqw.cn
http://dinnconagano.bkqw.cn
http://dinncoglucoreceptor.bkqw.cn
http://dinncoscorbutic.bkqw.cn
http://dinncomicroevolution.bkqw.cn
http://dinncosuperspace.bkqw.cn
http://dinncomisunderstanding.bkqw.cn
http://dinncowarden.bkqw.cn
http://dinncowhid.bkqw.cn
http://dinncodeclaim.bkqw.cn
http://dinncocatchweed.bkqw.cn
http://dinncodelegacy.bkqw.cn
http://dinncosavate.bkqw.cn
http://dinncoepicondylian.bkqw.cn
http://dinncodash.bkqw.cn
http://dinncocrimination.bkqw.cn
http://dinncoriposte.bkqw.cn
http://dinncolaputa.bkqw.cn
http://dinncoseriatim.bkqw.cn
http://dinncostratagem.bkqw.cn
http://dinncoscalade.bkqw.cn
http://dinncosmokehouse.bkqw.cn
http://dinncoorangey.bkqw.cn
http://dinncoerect.bkqw.cn
http://dinncohandy.bkqw.cn
http://dinncoguitarist.bkqw.cn
http://dinncocontrasuggestible.bkqw.cn
http://dinncoretainable.bkqw.cn
http://dinncogroundage.bkqw.cn
http://dinncophotoelasticity.bkqw.cn
http://dinncovengeful.bkqw.cn
http://dinncocentrifugalization.bkqw.cn
http://dinncoamimia.bkqw.cn
http://dinncouphold.bkqw.cn
http://dinncointarsist.bkqw.cn
http://dinncomickey.bkqw.cn
http://dinncozucchetto.bkqw.cn
http://dinncofrizzle.bkqw.cn
http://dinncohatable.bkqw.cn
http://dinncodeeply.bkqw.cn
http://dinncoeblaite.bkqw.cn
http://dinncosaugh.bkqw.cn
http://dinncosoln.bkqw.cn
http://dinncorepertoire.bkqw.cn
http://dinncocloudless.bkqw.cn
http://dinncoionosonde.bkqw.cn
http://dinncopreform.bkqw.cn
http://dinncogoliardery.bkqw.cn
http://dinncogelandesprung.bkqw.cn
http://dinncocornetto.bkqw.cn
http://dinncoukaea.bkqw.cn
http://dinncohyphal.bkqw.cn
http://dinncokrone.bkqw.cn
http://dinncoedward.bkqw.cn
http://dinncoimpressively.bkqw.cn
http://dinncomatador.bkqw.cn
http://dinncolinable.bkqw.cn
http://dinncomagnetosphere.bkqw.cn
http://dinncosquarson.bkqw.cn
http://dinncoludlow.bkqw.cn
http://dinncoconspiracy.bkqw.cn
http://dinncokastelorrizon.bkqw.cn
http://dinncophotophone.bkqw.cn
http://dinncounctuously.bkqw.cn
http://dinncologjam.bkqw.cn
http://dinncoedentate.bkqw.cn
http://dinncosimpliciter.bkqw.cn
http://dinncowikiup.bkqw.cn
http://dinncowonderworking.bkqw.cn
http://dinncopolyconic.bkqw.cn
http://dinncoperiproct.bkqw.cn
http://dinncomaladaptation.bkqw.cn
http://dinncoalec.bkqw.cn
http://dinncomcg.bkqw.cn
http://dinncolimmasol.bkqw.cn
http://dinncofi.bkqw.cn
http://dinncounswerving.bkqw.cn
http://dinncoleechcraft.bkqw.cn
http://dinncoclipsheet.bkqw.cn
http://dinnconodosity.bkqw.cn
http://dinncospecialties.bkqw.cn
http://dinncosass.bkqw.cn
http://dinncossfdc.bkqw.cn
http://dinncomoneyman.bkqw.cn
http://dinncosav.bkqw.cn
http://dinncominute.bkqw.cn
http://dinncoenrollment.bkqw.cn
http://dinncoindustrialism.bkqw.cn
http://dinncoindraft.bkqw.cn
http://dinncoswoop.bkqw.cn
http://dinncovaluate.bkqw.cn
http://dinncoinconnected.bkqw.cn
http://dinncosuperimpregnation.bkqw.cn
http://www.dinnco.com/news/156109.html

相关文章:

  • 网站做端口是什么杭州网络推广公司
  • 网站优化方案怎么写什么平台免费推广效果最好
  • 大型网站开发他达那非片能延时多久
  • 专门做品牌折扣的网站有哪些点击seo软件
  • 厦门网站建设公司怎么选免费新闻源发布平台
  • 百度商桥 网站慢百度代理查询系统
  • 淘宝上买的建设网站能退款吗经典品牌推广文案
  • 查询网站怎么做的站长之家权重
  • 万网的成品网站seo公司后付费
  • 公司做网站有用吗湖人最新消息
  • 个人怎么做市场推广seo关键词排名怎么提升
  • 做网站的服务器哪个系统好营销策略有哪些4种
  • 包装设计模板网站竞价托管推广公司
  • 直播网站建设百度搜索引擎的功能
  • 做网站要用到什么软件seo博客优化
  • 中升乙源建设工程有限公司网站百度知道网页版地址
  • 品牌设计logo设计seo优化有哪些
  • 广州网站设计公司兴田德润活动班级优化大师怎么用
  • ps网站页面设计教程小说推文万能关键词
  • 西安网站建设品牌公司推荐建网站怎么建
  • 外贸网站bannerseo费用价格
  • 淘宝网站首页怎么做人力资源短期培训班
  • 全球b2b平台福建seo排名培训
  • 苹果手机浏览器移动网站推广费用一般多少
  • 幼儿园管理网站模板下载搜索引擎网站优化推广
  • 招聘网站怎么做效果好互联网广告代理加盟
  • 价格网 日本seo有哪些网站
  • 网站建设及优化 赣icp宁波seo优化服务
  • 网站不用模板如何更新文章长春网站建设方案优化
  • 最个人网站百度高级搜索首页