什么是C ++整数常量?
整数常数是没有小数部分或指数的常数数据元素。他们总是以数字开头。您可以以十进制,八进制或十六进制形式指定整数常量。他们可以指定有符号或无符号类型以及长或short类型。
在C++中,您可以使用以下代码创建一个整数常量-
#include<iostream>
using namespace std;
int main() {
const int x = 15; // 15 is decimal integer constant while x is a constant int.
int y = 015; // 15 is octal integer constant while y is an int.
return 0;
}您可以在https://msdn.microsoft.com/zh-cn/library/00a1awxf.aspx上找到完整的语法来指定整数常量。
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短