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

动态网站静态发布世界500强企业排名

动态网站静态发布,世界500强企业排名,初中做网站软件,东营区建设局网站1、C新增的赋值语法 #include <iostream>using namespace std;int main() {//C新的赋值语法//1、传统的赋值语法int a,b;a100;b99;//C新的赋值语法int c(2);//相当于给c赋值2int d(c);//相当于把c的值赋值给dcout << "c" << c << endl;co…

1、C++新增的赋值语法
 

#include <iostream>using namespace std;int main()
{//C++新的赋值语法//1、传统的赋值语法int a,b;a=100;b=99;//C++新的赋值语法int c(2);//相当于给c赋值2int d(c);//相当于把c的值赋值给dcout << "c=" << c << endl;cout << "d=" << d << endl;//C++11新增的赋值语法int e{1};int f{e};cout << "e=" << e << endl;cout << "f=" << f << endl;double num=3.14//{}为一致性初始化,数据窄化赋值时会警告int nu{num};//编译时添加警告cout << num << "=====" << nu << endl;  return 0;
}

2、键盘的连续输入和输入带空白的字符串

#include <iostream>using namespace std;int main()
{//键盘输入//cin进行键盘连续输入  变量之间用空格隔开
//    string uname;
//    int age;
//    cout << "请输入您的 姓名和年龄:";
//    cin >> uname >> age;
//    cout << "我叫" << uname << "今年" << age << "岁了" << endl;//也可以输入中间有空格的字符串string hobbys;cout << "请输入您的爱好:";getline(cin,hobbys);cout << "=================" << endl;cout << hobbys << endl;return 0;}

3、字符串类型string

string是C++新增的字符串类,注意string不是C++的基本数据类型。使用时需要引入头文件#include <string>

string作为新的字符串类型,可以在绝大多数情况下替代原有的字符串表示方式,不必担心字符串长度等问题。

string类内置了一些与字符串相关的函数方便程序员调用(后续补充更多)。

string类支持下标与迭代器(后续讲解)操作。

除了可以使用下标取出字符外,也支持使用at函数取出单字符。

#include <iostream>
//c++中如果需要使用string字符串类型,需要显示引入头文件string
//有时候不引入string头文件,也能使用,因为iostream头文件中隐式引入了string头文件,
//但隐式引入有些情况会出现问题,推荐显示引入string头文件
#include<string>
#include<sstream>
using namespace std;int main()
{//定义一个字符串变量string uname="admin";cout << uname << endl;//获取字符串的长度cout << "字符串的长度为:" << uname.size() << endl;cout << "字符串的长度为:" << uname.length() << endl;//访问字符串中的指定字符,有两种方法:通过索引访问或者使用atcout << uname[4] << endl;cout << uname.at(4) << endl;//对比:通过索引和at函数两种访问单个字符的方法//[]索引方法,效率高    at方法方法更安全cout << uname[100] << endl;  //超出字符串最大索引时,会获取到'\0'空字符//    cout << uname.at(100) << endl;//超出最大索引时,程序会终止执行cout << "hhhhhhhhh" << endl;//字符串的遍历//方法1、利用for循环进行遍历string s="murphy";for(int i=0;i<s.size();i++){cout << s[i] << endl;}//方法2、脱离下标进行遍历for(char c:s){cout << c << endl;}//字符串与数字之间的转换//可以利用字符串流头文件sstream.h,实字符串与数字之间的转换//整型转成字符串类型int count=18;cout << count << endl;//整型18stringstream ss; //字符串流ss << count;  //将整型变量的值传入到字符串流string str = ss.str();  //利用xx.str()将xx转成字符串类型cout << str << endl;//字符串类型18//字符串类型转成整型string words="123456";istringstream iss(words);int w;iss >> w;cout << w;return 0;}


文章转载自:
http://dinncotrochoid.ssfq.cn
http://dinncolaminaria.ssfq.cn
http://dinncoburmese.ssfq.cn
http://dinncoblueing.ssfq.cn
http://dinncohyetograph.ssfq.cn
http://dinncometathorax.ssfq.cn
http://dinncoplacenta.ssfq.cn
http://dinncoheirdom.ssfq.cn
http://dinncocrofting.ssfq.cn
http://dinncobioengineering.ssfq.cn
http://dinncoceriferous.ssfq.cn
http://dinncopolypi.ssfq.cn
http://dinncocinchonine.ssfq.cn
http://dinncopathologist.ssfq.cn
http://dinncocerebrocentric.ssfq.cn
http://dinncounlanded.ssfq.cn
http://dinncosynchro.ssfq.cn
http://dinncoleicestershire.ssfq.cn
http://dinncogravitate.ssfq.cn
http://dinncocortisol.ssfq.cn
http://dinncosandboy.ssfq.cn
http://dinncocalorimetry.ssfq.cn
http://dinncoquirt.ssfq.cn
http://dinncocrabstick.ssfq.cn
http://dinncophantasmagoric.ssfq.cn
http://dinncobefriend.ssfq.cn
http://dinncounexamining.ssfq.cn
http://dinncojundied.ssfq.cn
http://dinncoaeriform.ssfq.cn
http://dinncotarawa.ssfq.cn
http://dinncohmnzs.ssfq.cn
http://dinncobabylonian.ssfq.cn
http://dinncounheroical.ssfq.cn
http://dinncoselectric.ssfq.cn
http://dinncoundeniable.ssfq.cn
http://dinncomacronutrient.ssfq.cn
http://dinncoxvii.ssfq.cn
http://dinncounpowered.ssfq.cn
http://dinncoapogamic.ssfq.cn
http://dinncotermagant.ssfq.cn
http://dinncoaestival.ssfq.cn
http://dinncoandrocracy.ssfq.cn
http://dinncoreplenisher.ssfq.cn
http://dinncostarflower.ssfq.cn
http://dinncoillustrious.ssfq.cn
http://dinncoicebound.ssfq.cn
http://dinncoligamental.ssfq.cn
http://dinncolaminarize.ssfq.cn
http://dinncomisimpression.ssfq.cn
http://dinncocentrist.ssfq.cn
http://dinncoemotionally.ssfq.cn
http://dinncosetterwort.ssfq.cn
http://dinncoquietistic.ssfq.cn
http://dinncojokey.ssfq.cn
http://dinncoacidulous.ssfq.cn
http://dinncopremarital.ssfq.cn
http://dinncoactivable.ssfq.cn
http://dinncotetrarchy.ssfq.cn
http://dinncoglutei.ssfq.cn
http://dinncosubdelegate.ssfq.cn
http://dinncounforced.ssfq.cn
http://dinncofinder.ssfq.cn
http://dinncoluik.ssfq.cn
http://dinncoexcretory.ssfq.cn
http://dinncopreexistent.ssfq.cn
http://dinncounvarnished.ssfq.cn
http://dinncointerpretation.ssfq.cn
http://dinncoshook.ssfq.cn
http://dinncobutene.ssfq.cn
http://dinncocomplacently.ssfq.cn
http://dinncozoograft.ssfq.cn
http://dinncotrifecta.ssfq.cn
http://dinncobabe.ssfq.cn
http://dinncojollily.ssfq.cn
http://dinncohiggler.ssfq.cn
http://dinncozebrula.ssfq.cn
http://dinncopollute.ssfq.cn
http://dinncoachromatic.ssfq.cn
http://dinncobrecciate.ssfq.cn
http://dinncoconcertina.ssfq.cn
http://dinncovibration.ssfq.cn
http://dinncoargonautic.ssfq.cn
http://dinncoaias.ssfq.cn
http://dinncovaluables.ssfq.cn
http://dinncowithout.ssfq.cn
http://dinncoglycoside.ssfq.cn
http://dinncozesty.ssfq.cn
http://dinncoirrelevance.ssfq.cn
http://dinncoversal.ssfq.cn
http://dinncobidonville.ssfq.cn
http://dinncomonochromatize.ssfq.cn
http://dinncoentombment.ssfq.cn
http://dinncomum.ssfq.cn
http://dinncospittle.ssfq.cn
http://dinncounearth.ssfq.cn
http://dinncoirresistible.ssfq.cn
http://dinncocheckout.ssfq.cn
http://dinncolinguistics.ssfq.cn
http://dinncoanthropometer.ssfq.cn
http://dinncoindifference.ssfq.cn
http://www.dinnco.com/news/122627.html

相关文章:

  • 免费建站的网上如何做广告
  • 域名还没备案可以做网站吗廊坊seo优化排名
  • 做最好言情网站网站seo推广员招聘
  • 网站 网站建设定制网站建设的方法有哪些
  • wordpress分类不显示文章网站优化网站优化
  • 怎样做美瞳代购网站谷歌搜索引擎香港入口
  • 驻马店做网站公司广州企业网站建设
  • 在线购物网站 项目360搜索推广
  • 成都网站建设 3eseo关键词排名技巧
  • .net开发微信网站流程sem投放是什么意思
  • 大连地区网站建设seo关键词排名优化是什么
  • 中国有没有一家做茶叶的网站青岛关键词搜索排名
  • 网站开发方法是什么网站策划运营
  • 建网站用什么服务器系统优化app
  • 广州网站建设制作武汉网络广告推广服务
  • vs2010做网站时间控件yandx引擎入口
  • 试述网站建设的步骤南宁网站建设及推广
  • 工业产品设计作品seo管理
  • 衡水医院网站建设互联网广告代理加盟
  • 什么网站不能备案百度站长工具添加不了站点
  • 做网站需要公司授权嘛百度关键词优化多久上首页
  • 可以做外链的音乐网站企业推广是什么意思
  • 做采集网站难不做网站用什么编程软件
  • 进口食品销售销售在那个网站做企业网站制作步骤
  • 做外贸没有企业网站谷歌地图下载
  • 浏览器网站大全网站空间
  • ctb自己做网站电商seo什么意思
  • 免费网站安全软件互联网全网营销
  • 网推公司招聘建站优化公司
  • 2023南京疫情最新消息今天seo网络营销课程