变量和基本类型
来源:互联网 发布:新疆干部网络培训学院 编辑:程序博客网 时间:2024/05/16 19:03
基本内置类型
2.1基本内置类型
2.1.1算术类型
代码日记:
//#include "stdafx.h"#include <iostream>using namespace std;/*基本内置类型分为算术类型(arithmetic type)和空类型(void)*///2.1.1算术类型void arithmetic_type(void){ /*#算术类型分为# *integral type(字符型和布尔型也是整型)和浮点型 */ bool bool_example = true;// cout << "bool:"<<sizeof(bool)<<"byte "<<bool_example<<endl; char char_example = 'a';//字符,8位 cout << "char:" << sizeof(char) << "byte " << char_example << endl; wchar_t wchar_t_example = 'a';//宽字符,至少16位 cout << "wchar_t" << sizeof(wchar_t) << "byte " << wchar_t_example << endl; char16_t char16_t_example = 'a';//最少16位,使用Unicode字符集 cout << "char16_t:" << sizeof(char16_t) << "byte " << char16_t_example << endl; char32_t char32_t_example = 'a';//最少32位,使用Unicode字符集 cout << "char32_t:" << sizeof(char32_t) << "byte " << char32_t_example << endl; short short_example = 10;//最少16位 cout << "short:" << sizeof(short) << "byte " << short_example << endl; int int_example = 10;//至少和short一样大,最小16位 cout << "int:" << sizeof(int) << "byte " << int_example << endl; long long_example = 10;//至少和int一样大,最小32位 cout << "long:" << sizeof(long) << "byte " << long_example << endl; long long long_long_example = 10;//至少和long一样大,最小64位 cout << "long long:" << sizeof(long long) << "byte " << long_long_example << endl; float float_example = 10;//最小尺寸,6位有效数字 cout << "float:" << sizeof(float) << "byte " << float_example << endl; double double_example = 10;//最小尺寸,10位有效数字 cout << "double:" << sizeof(double) << "byte " << double_example << endl; long double long_double_example = 10;//最小尺寸,10位有效数字 cout << "long double:" << sizeof(long double) << "byte " << long_double_example << endl;}//2.1.2类型转换void type_convert(void){}int main(){ arithmetic_type(); system("pause"); return 0;}
阅读全文
0 0
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 变量和基本类型
- 基本类型变量和类型变量+基础
- Lesson01变量和基本类型
- 学习变量和基本类型
- 二、变量和基本类型
- C++变量和基本类型
- 变量和基本类型一
- 变量和基本类型二
- chapter2.变量和基本类型
- 2. 变量和基本类型
- 数据结构每日一题
- SpringMVC +Spring + Hibernate4 整合
- AndroidStudio引用aar文件碰到的问题
- Ubuntu修改MySQL默认数据库目录
- Python开发环境搭建
- 变量和基本类型
- 自己动手搭建个人博客到优化
- 网易2013校招笔试题(抓鱼问题)(未完待续)
- POJ 3069
- private、protected、public三者权限控制区别
- datagraid实现分页效果
- 杭州三天面试后的感想,热!真热!
- Kali Linux(3)-安装Windows与Kali Linux双系统
- web 学习笔记15-JDBC大数据 批处理 存储过程 事务