C/C++ 与运算和或运算转换大小写
// & 与,将指定位置设置为0 | 或,将指定位置设置为1
//注: 只针对纯字母的情况
#include <stdio.h>
#include <string>
int main()
{
char str[6] = "xxing";
std::string str1 = "INGXX";
for(int i = 0; i < 5; i++)
{
str[i] &= 0xdf;// 转大写 1101 1111
str1[i] |= 0x20;// 转小写 0010 0000
}
printf("xxing:%s\nINGXX:%s\n", str, str1.c_str());
return 0;
}
相关文档:
@echo off
@echo ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗
@echo ┋ 心 如 止 水 ┋
@echo ┋ ┋
@echo ┋ DIY 个 性 BAT C 盘 防 毒 批 处 理 ┋
@echo ┋ ......
C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick
Share | ......
1.引言
C++语言的创建初衷是“a better
C”,但是这并不意味着C++中类似C语言的全局变量和函数所采用的编译和连接方式与C语言完全相同。作为一种欲与C兼容的语言,C++保留了一部分过程
式语言的特点(被世人称为“不彻底地面向对象”),因而它可以定义不属于任何类的全局变量和函数。但是,C++ ......
大学已经来到了最重要的时期了,我不能再一事无成了。光说没用,所以就在这里写下文章,以记录我的成长历程。
这学期刚好学到数据结构,那就将题目分析的过程及代码写下来,供以后自己取舍。因本人水平一般,所以代码并不一定是最优的,但是我会努力改进,做最好的自己! ......
1、在C文件中调用C++文件中定义的文件
直接的方法是在C++ 文件的头部添加如下代码段:
extern "C"
{
int API(int A);
}
2、C++接口的方法
在C++中调用C的函数,在C头文件中加入如下代码:
#ifdef __cplusplus // 开始
exte ......