
C/C++
icankeep
优雅程序猿
展开
-
利用移位操作进行取余
c/c++移位取余优化原创 2017-07-07 23:30:23 · 4817 阅读 · 1 评论 -
使用qsort对二维int型数组排序
利用qsort对二维数组排序原创 2017-07-07 23:36:53 · 2533 阅读 · 0 评论 -
浅谈C语言中常用函数
1.getchar() 从stdio流中读字符,相当于getc(stdin),它从标准输入里读取下一个字符。返回类型为int型,返回值为用户输入的ASCⅡ码,出错返回-1。用法 函数声明在stdio.h头文件中,使用的时候要包含stdio.h头文件。如: #include int getchar(void原创 2017-07-08 23:45:34 · 259 阅读 · 0 评论 -
用位(与和或)操作实现字母大小写转换
//小写转大写#include <iostream>using namespace std;int main(){ char a = 'c'; char b = a&(0b11011111); cout<<b<<endl;} //大写转小写#include <iostream>using namespace std;...原创 2019-01-12 19:48:38 · 618 阅读 · 0 评论 -
或操作实现数字转ASCII
#include <iostream>using namespace std; int main(){ int a = 5; int b = 5 | 48; cout<<b<<endl;}原创 2019-01-12 19:54:42 · 827 阅读 · 0 评论