![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++学习碎片
baomingzhe
这个作者很懒,什么都没留下…
展开
-
c++位移运算符
#include #include int main() { short a = 2017; a=a << 5; a=a >> 5; std::cout << a; return 0; } 输出为-31,当a为-2017时,为31。 执行左移操作时,符号位会一同左移,右侧补零。 执行右移操作时,左侧会补与符号位相同的数字,可能为0,可能为1。原创 2017-08-29 22:25:34 · 682 阅读 · 0 评论 -
关于sizeof运算符的文档
在vs2013关于sizeof的文档中有 When the sizeof operator is applied to an object of type char, it yields 1. When the sizeof operator is applied to an array, it yields the total number of bytes in that array, n翻译 2017-08-30 12:00:43 · 200 阅读 · 0 评论 -
排序数组输出指定数字个数
2017移动端 测试题 1. 题目: 在排序数组中,找出给定数字的出现次数,时间效率越高越好,比如 [1, 2, 2, 2, 3] 中2的出现次数是3次。 输入: 1,2,2,2,3 输出: 1(1) 2(3) 3(1) 不定长度可以存入向量,在存入的过程中进行比较并保存结果,最后进行输出。这样就能满足此题目的输入输出的要求。但是需要把所有的结果都列出原创 2017-08-30 15:31:07 · 469 阅读 · 0 评论