C++基础
文章平均质量分 79
xujun19842010
这个作者很懒,什么都没留下…
展开
-
基础函数的实现(strcpy,strcat, strcmp, atoi, itoa)
基础函数的实现(strcpy,strcat, strcmp, atoi, itoa) strcpy: /********************** * C语言标准库函数strcpy的一种典型的工业级的最简实现 * 返回值: * 返回目标串的地址。 * 对于出现异常的情况ANSI-C99标准并未定义,故由实现者决定返回值,通常为NULL。 * 参数: * strDeatinat转载 2012-01-29 11:18:06 · 302 阅读 · 0 评论 -
C++ 运算符优先级列表
C++ 运算符优先级列表 http://www.cppreference.com/operator_precedence.html Precedence Operator Description Example Associativity 1 () [] -> . :: ++ -- Grouping operator Array access转载 2012-02-10 18:11:52 · 219 阅读 · 0 评论 -
最常见的20种VC++编译错误信息
最常见的20种VC++编译错误信息 http://blog.sina.com.cn/s/blog_638194b00100l5ef.html 1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(转载 2012-02-11 15:04:50 · 496 阅读 · 0 评论 -
C++ strings(字符串)详解
之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用 = 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽可以把它看成是C++的基本数据类型。 好了,进入正题……… 首先,为了在我们的程序中使用st转载 2012-02-11 15:13:38 · 518 阅读 · 0 评论 -
面试题(来自程序员面试宝典)
面试例题:输入n,求一个nXn矩阵,规定矩阵沿45度递增,形成一个zigzag数组(JPEG编码里取像素数据的排列顺序),请问如何用C++实现? (中国台湾著名感伤公司2007年11月面试题) #include #include int main() { int N; int s,i,j; int squa; scanf("%d",&N); int **转载 2012-02-22 22:22:15 · 269 阅读 · 0 评论 -
sizeof()与strlen()的区别
int main( ) { char str0[8]={'a','b','c','d','e','f','i','g'}; char str1[]="abcdefig"; char str2[]="01234\056789" ; char str3[]="abcse\0fgkij"; printf("strl转载 2012-02-11 15:46:14 · 345 阅读 · 0 评论 -
(int&)a和(int)a的区别
[cpp] view plaincopy #include #include #include using namespace std; int main() { float a = 1.0f; cout int)a cout int&)a cout int)a == (int&)转载 2012-02-20 17:37:54 · 264 阅读 · 0 评论