2016年9月28日

字符串取地址

摘要: #include #include #include #include #include #include #include #include using namespace std; int main() { char *p="fdg"; cout(p)(&str[0])<<endl; } cout<<&str[0]<<endl;输出的事整个字符串 阅读全文

posted @ 2016-09-28 23:01 邗影 阅读(1943) 评论(0) 推荐(0) 编辑

输入数字个数以及要找的位置,输出以字典序为准的那个数

摘要: 输入 12 4 输出 12 1,10,11,12,2,3,4,5,6,7,8,9 c++的。。。哎。。。JRTT第一题 阅读全文

posted @ 2016-09-28 21:22 邗影 阅读(433) 评论(0) 推荐(0) 编辑

delete[] p与 delete p

摘要: 基本类型的对象没有析构函数,所以回收基本类型组成的数组空间用 delete 和 delete[] 都是应该可以的;但是对于类对象数组,只能用 delete[]。对于 new 的单个对象,只能用 delete 不能用 delete[] 回收空间。 上边这句是转载的,因为自己也不太明白。记下来、、、 析 阅读全文

posted @ 2016-09-28 16:37 邗影 阅读(326) 评论(0) 推荐(0) 编辑

友元函数友元类

摘要: 友元函数和友元类 采用类的机制后实现了数据的隐藏与封装,类的数据成员一般定义为私有成员,成员函数一般定义为公有的,依此提供类与外界间的通信接口。但是,有时需要定义一些函数,这些函数不是类的一部分,但又需要频繁地访问类的数据成员,这时可以将这些函数定义为该函数的友元函数。除了友元函数外,还有友元类,两 阅读全文

posted @ 2016-09-28 16:26 邗影 阅读(191) 评论(0) 推荐(0) 编辑

c++ sizeof,strlen, length

摘要: #include <map> #include <iostream> #include <algorithm> #include <functional> #include<forward_list> #include<unordered_map> #include<share.h> using n 阅读全文

posted @ 2016-09-28 15:42 邗影 阅读(367) 评论(0) 推荐(0) 编辑

导航