随笔分类 -  C++

摘要:#include<iostream>#include<string>#include<complex>using namespace std;void main(){ complex <int> num1(3, 4); complex <float> num2(3.3, 4.5); string s 阅读全文
posted @ 2016-03-21 22:34 知_行 阅读(715) 评论(0) 推荐(0)
摘要:运行结果如图所示 阅读全文
posted @ 2016-03-20 21:53 知_行 阅读(238) 评论(0) 推荐(0)
摘要:#include<iostream> #include<string> using namespace std; void main() { string str1("i am here!"); string str2="where are you?"; cout << str1[0] << str 阅读全文
posted @ 2016-03-12 01:06 知_行 阅读(163) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; struct point{ //private: double x, y; //public: void setxy(double a,double b) { x = a; y = b; } void display() 阅读全文
posted @ 2016-03-07 23:50 知_行 阅读(265) 评论(0) 推荐(0)
摘要:#include<iostream> #include<algorithm> #include<functional> #include<iterator> using namespace std; void main() { int a[] = { 5, 7, 3, 4, 6 }; sort(a, 阅读全文
posted @ 2016-03-06 00:33 知_行 阅读(419) 评论(0) 推荐(0)
摘要:演示数组复制输出的例子 本来数组复制输出和反转输出可以合二为一,但是发现其中要用到的函数所需头文件不一致,因此该例子分开 在C++教学视频中发现algorithm头文件不包括ostream_iterator函数,但是视频中并为做说明,因此记录下来 注意,截图代码中ostream_iterator参数 阅读全文
posted @ 2016-03-05 16:37 知_行 阅读(6661) 评论(0) 推荐(1)
摘要:#include<iostream> using namespace std; int max(int, int); int max(int, int, int); void main() { cout << max(25, 39) << ","<< max(13, 14, 15) << endl; 阅读全文
posted @ 2016-02-27 12:48 知_行 阅读(564) 评论(0) 推荐(0)
摘要:点滴积累,路虽远,行必至! 程序1,将2个结构域值相加,乘以2再加50 #include<iostream> using namespace std; int result(int, int); const int k = 2; struct point{ int x, y; }; int main 阅读全文
posted @ 2016-02-21 15:32 知_行 阅读(191) 评论(0) 推荐(0)
摘要:[root@db code]# more code1.c /*文件描述符 */ /* * 在Linux下文件描述符来表示设备文件和普通文件,文件描述符是一个整型数据,所有对 文件的操作都是通过文件描述符实现 * 文件描述符是文件系统中链接用户空间和内核空间的枢纽,当打开一个或创建一个文件时 ,内核空 阅读全文
posted @ 2015-11-17 14:51 知_行 阅读(753) 评论(0) 推荐(0)