C/C++
文章平均质量分 53
junning51
这个作者很懒,什么都没留下…
展开
-
#pragma once与 #ifndef的区别
为了避免同一个文件被include多次1 #ifndef方式2 #pragma once方式在能够支持这两种方式的编译器上,二者并没有太大的区别,但是两者仍然还是有一些细微的区别。 方式一: #ifndef __SOMEFILE_H__ #define __SOMEFILE_H__ ... ... // 一些声明语句转载 2013-06-23 11:08:27 · 469 阅读 · 0 评论 -
// 复制源文件内容到目标文件
#include #include int main(){//system("copy d:\\source_file.txt e:\\destination_file.txt")system("copy d:\\src.txt d:\\des.txt ");return 0;}转载 2013-10-26 21:18:24 · 479 阅读 · 0 评论 -
// 比较 strlen(str)和 sizeof(str)的不同
#include #include "string.h"int main(){int x = 0;char str[10] ; // strlen()以'\0',作为结束标志,故strlen(str)不确定x = strlen(str); printf("strlen of str is: %d \n",x);x = sizeof(str); //而原创 2013-10-26 22:02:04 · 620 阅读 · 0 评论 -
// 比较 strlen(str)和 sizeof(str)的不同 2
#include #include "string.h"int main(){int x = 1122867; // 0x112233 == 1122867char str[10] ; // strlen()以'\0',作为结束标志,故strlen(str)不确定printf("strlen of str is: %d \n",strlen(str));原创 2013-10-27 22:16:19 · 525 阅读 · 0 评论 -
C++的string类
/* ** 注意iostream与iostream.h的区别** 原来iostream是C++的头文件,iostream.h是C的头文件,** 即标准的C++头文件没有.h扩展名**** iostream.h里面定义的所有类以及对象都是在全局空间里,** 所以你可以直接用cout 但在iostream里面,** 它所定义的东西都在名字空间std里面,** 所以你必须原创 2013-11-18 21:25:35 · 677 阅读 · 0 评论 -
C++写的书上一个简单的电话薄程序
#include "Address.h"#include "AddressBook.h"#include #include #include #include using namespace std;int MenuSelect(void);int main(){char g_choice;AddressBook g_maillist;for原创 2013-11-20 09:50:42 · 4123 阅读 · 1 评论