第1⑵章 变量和基本类型
1.下面这个语句在C++98和C++11中的输出结果不同.
C++98结果:
(如果想要更高的精度,可以用%.9lf,输出9位有效数字)
C++11结果:
结论:
printf的%lf在C++11中表示longdouble,所以用中%f就能够输出float和double类型.而printf在C++98中可以用%lf正确输出double.
如果是scanf的话,不论C++98还是C++11中float都用%f读取,double都用%lf读取,由于2者结构不同.
2. 默许初始化
定义变量时没有指定初值,变量被默许初始化.
内置类型:如果是全局的(变量),那末就初始为0.如果是局部的,那末值不肯定.
类类型:得看该类对象是否是全局的和该类的默许构造函数了.
2.1如果该类的默许构造函数不支持定义对象不给定初值,那末就报错.
2.2如果支持定义对象不给初值,那末就履行默许构造函数的初始化.
2.3如果该类用的是合成的默许构造函数,那末就履行默许初始化.默许初始化时,对成员是对象的履行它的默许构造函数(有点递归的意思),对成员是内置类型的履行默许初始化(全局置0,局部未定义)
上面的结果可以看出,s成员始终都是空串.而a对象和b对象的int
a和 int b成员 由于位置不同,值也不同.
3. 如何定义1个指向指针的援用:
4. const变量是仅在当前文件内有效的,那末我们如何定义且使用全局const呢?
在1个文件如 extern const int a=100;定义,在其他所有需要用到a的文件内声明如 extern const int a;
Add.h文件
Add.cpp文件
main.cpp文件
其实这个与我们第1章定义全局变量有点类似.
5. auto与decltype用法的区分。
auto会消除顶层const,decltype不会。
对援用类型,auto得到1个普通类型,decltype得到援用。
decltype((i))时得到的是i类型的援用,decltype(i)得到i类型。
波比源码 » C++ Primer学习总结 第1-2章 变量和基本类型
levaquin pills levaquin online
avodart usa tamsulosin drug order ondansetron 8mg online
buy spironolactone online cheap fluconazole 100mg sale diflucan 200mg oral
order fildena 100mg online order generic tamoxifen 20mg robaxin pills
buy sildenafil 100mg order aurogra sale purchase estradiol generic
lamotrigine brand buy vermox 100mg generic tretinoin gel drug
generic tadalafil order tadalafil 10mg online cheap voltaren pills
order isotretinoin 20mg isotretinoin us cost zithromax 250mg
indocin without prescription amoxicillin online buy purchase amoxicillin without prescription
usa cialis overnight vacuum pump for ed buy sildenafil 50mg generic
acheter gГ©nГ©rique tadalafil en france sildenafil 50mg comprimГ© sildenafil 100mg pour homme
isotretinoin 40mg cost amoxil brand ivermectin 0.5 lotion
doxycycline 100mg uk buy vardenafil pills buy lasix 40mg generic
clonidine 0.1 mg usa cheap catapres 0.1 mg order spiriva 9mcg online
buspirone brand purchase buspar generic oxybutynin tablet
buy fosamax online cheap buy panadol 500 mg generic famotidine 40mg usa
buy bupropion 150mg generic bupropion 150mg cost order quetiapine 50mg pills
order generic molnupiravir 200mg order naproxen 500mg without prescription lansoprazole 30mg canada
order zoloft generic Buy viagra viagra online
imuran 100mcg drug viagra 50mg price cheap generic sildenafil
order tadalafil 10mg pills cialis 5mg pill symmetrel without prescription
brand naltrexone 50mg albendazole 400mg cost abilify 20mg uk
dapsone without prescription dapsone price cost perindopril 8mg
nootropil 800mg sale generic sildenafil 100mg sildenafil 100mg sale
cialis pharmacy cialis walmart order viagra pill
cheap lasix 100mg buy furosemide generic buy plaquenil 200mg generic
buy aralen for sale buy cenforce 50mg generic order baricitinib without prescription
glucophage price tadalafil uk order tadalafil pill
zyprexa drug olanzapine 10mg ca order diovan 80mg generic
norvasc 10mg pill female viagra pill cialis 5mg for sale
clozapine buy online buy combivent without prescription decadron online
order sildenafil for sale order lisinopril 2.5mg generic order lisinopril 2.5mg generic
order omeprazole 20mg pills online casino gambling big fish casino online
purchase zyvox online buy linezolid 600mg that roulette
metoprolol 100mg brand vardenafil over the counter brand levitra 20mg
buy an essay online cheap academic writing blog gambling addiction
buy an essay online custom research paper writing viagra 100mg uk
buy clomiphene 50mg online clomid over the counter free roulette online
buy cialis 40mg online cheap cialis 40mg oral cheap viagra
buy aristocort 10mg for sale desloratadine 5mg pill order clarinex pill
order dapoxetine 60mg generic brand misoprostol 200mcg purchase synthroid pills
order tadalafil 40mg viagra fast shipping sildenafil 50mg us
order orlistat generic diltiazem 180mg oral acyclovir 800mg over the counter
order generic cialis 5mg clopidogrel brand plavix 150mg pills
order zyloprim online cheap buy zyloprim 300mg pills order zetia 10mg online
order domperidone 10mg online cyclobenzaprine 15mg uk flexeril 15mg without prescription
buy losartan pill order losartan 50mg pill topiramate drug
order baclofen 10mg online toradol 10mg uk toradol 10mg tablet
imitrex 25mg ca order sumatriptan sale avodart 0.5mg drug
cheap colchicine 0.5mg gambling casino casino moons online casino
purchase zantac online cheap buy zantac for sale celecoxib 100mg oral
casino slot free roulette free play for fun real casino online
tadalafil 40mg for sale tadalafil 5mg uk cipro buy online
buy simvastatin 20mg generic propecia online buy purchase finasteride online cheap
order cephalexin online cheap buy keflex for sale erythromycin 500mg usa
buy generic ceftin 500mg ceftin 250mg price robaxin pills
buy thesis paper buy stromectol 6mg generic ivermectin order
prednisone 40mg generic order amoxil generic order amoxil 1000mg online cheap
order sildenafil sale cheap cialis 40mg tadalafil india
no deposit bonus codes best online poker sites for real money buy tadalafil tablets