- 博客(26)
- 收藏
- 关注
原创 python 笔记
1. 输入 i = int(raw_input('input gain:\n'))2. 输出 print 'bonus = ', bonus3. if else 语句if i bonus = i * 0.1elif i bonus = i * 2000else: bonus = 10000 * 0.1 + (i - 100000)
2013-11-11 17:42:47 2005
原创 mzsystem
1. DNS 位于 TCP/IP 那一层,其工作原理?TCP/IP 协议包括 网络接口层, 【对应 OSI的 物理层 和 数据链路层】网络层, 【对应 OSI 的网络层 】传输层, 【对应 OSI 的 传输层】应用层。 【对应 OSI 的 会话层, 表示层, 应用层】 网络接口层, 网络层: IP , ICM
2013-11-05 21:37:55 703
转载 进程、线程 知识点整理
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>进程线程专题+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++同一进程中的线程究竟共享哪些资源线程共享的环境
2013-11-01 23:31:51 1510
原创 C/C++笔试知识点整理 37
1.sizeof 运算符是在程序的哪个阶段计算的,class A{};size_t a = sizeof(A);a = ?2. 你出生你年份的阶乘最后一位数是几?3.C++里的类,继承,多态,虚函数的用途?4.什么是设计模式,敏捷开发,重构?使用这些技术有什么好处?5.static函数与
2013-11-01 12:40:53 1459
转载 字符串组合
ex: str = "abc"result: abcabacbccode:#include #include #include using namespace std; #include void Combination(char *string ,int number,vector &result);
2013-11-01 12:33:34 799
转载 全排列的非递归解法
pre: I have forgot where the code comes from . There is a little flaws in the origin . The modified code is as flows://#include //#include #include#include using namespace
2013-11-01 12:31:58 736
原创 笔试知识点整理
1. C++创建一个接口类的方法: 通过纯虚基类实现接口。C++中没有提供类似interface这样的关键 字来定义接口,但是Mircrosoft c++中提供了__declspec(novtable)来修饰一个类,来表示该类没有虚函数表,也就是虚函数都是纯虚的。所以利用它我们依然可以定义一 个接口。代码例子如下http://xujingli88.blog.163.com/bl
2013-10-20 20:29:53 736
原创 数组名 vs 指针
ex:#include #include void test(char a[]){ a++; //ok printf(" second char is %c\n", a[0]);}void main() { char s[] = "abcde"; char *p = s; p += 2; //OK //s += 2; //error
2013-10-18 22:38:22 594
转载 0-1 背包问题
#includeint c[10][100];/*对应每种情况的最大价值*/int knapsack(int m,int n){ int i,j,w[10],p[10]; printf("请输入每个物品的重量,价值:\n"); for(i=1;i<=n;i++) scanf("%d,%d",&w[i],&p[i]); for(i=0;i<10;i++) f
2013-09-28 11:15:13 652
原创 字符串排序
错误如下:#include "stdafx.h"#include #include #include#define NAME_LEM 10int main(){ int i = 0, j = 0; int num = 0; scanf("%d", &num); char (*name)[NAME_LEM]; name = (char (*)[NAME_LEM
2013-09-15 18:50:37 719
原创 后缀字符串
char c[MAXCHAR], *a[MAXCHAR]; char src[MAXCHAR] = "asdfas"; int n=0; while( src[n] != '\0' ) { a[n] = &c[n]; c[n] = src[n]; n++; } c[n]='\0';
2013-09-10 20:17:46 540
原创 将一个字符串放在另一个字符串最前面or最后面,判断是否是能回文字符串
#include "stdafx.h"#include #include #include //若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1。 int checkCPU(void) { union { int a; char b; }c; c.a = 1; return (c.b =
2013-09-10 11:20:47 1096
原创 一些面试小题目: 12小球
现有12个小球,它们外形一模一样,但其中一个小球与其他11个小球的重量不相同 现有12个小球,它们外形一模一样,但其中一个小球与其他11个小球的重量不相同{注意:是不相同,不知道是比其他小球重还是轻}现在有个没砝码的天平,问怎样在3次之内利用这个天平把小球找出来?分三组:每组四个,第一组编号1-4,第二组5-8,第三组9-12.
2012-04-23 21:17:26 767
原创 几个简单但是不太常用的函数:cprintf, clrscr, strrev, cin.getline, strchr, strstr
几个简单但是不太常用的函数:cprintf 这个函数一般在 TC中使用。clrscr 只有在Turbo c 中可以运行 !在Turbo C++ 中,需要先另存为(save as).C格式,才能使用。 注:在VC中无法调用该函数,有下列办法: 1.#include windows.h> system("cls");
2012-04-23 17:23:08 1016
原创 map, fstream, error
这个程序看不是很懂~~~#include #include #include using namespace std; int main () { typedef multimap M1; typedef M1::value_type v_t1; M1 m1; typedef multimap > M2; typedef M2::value_ty
2012-02-24 13:54:31 541
原创 set::insert
#include #include using namespace std; void print (set >& s) { set >::iterator It; for ( It = s.begin(); It != s.end(); It++ ) cout << *It << " "; cout << endl; } int main () {
2012-02-23 11:45:27 3395
原创 error
set > s; 什么意思? 后面的 less 是什么意思?less 是保证set容器里面的元素师由小到大排列的,里面元素没有重复的。下面的程序主要是set的构造函数的练习。有错误。可不知道哪里错了。#include #include using namespace std;int main () { int ary[] = { 5,3,7,5,2,3,
2012-02-23 11:25:24 507
原创 template , for_each , fill
#include #include #include using namespace std; template class Print { public: void operator () (T& t) { cout << t << " "; } }; int main () {
2012-02-22 16:02:11 417
原创 vector_constructors
#include #include #include //#include using namespace std;int main(){ string str[] = {"Alex", "John", "Robert"}; vector v1; //empty vector object vector v2(10); //creates vector with 10 elem
2012-02-21 17:04:27 513
原创 set:: erase
set:: erase功能:将一个或一定范围的元素删除语法:iterator erase(iterator _Where)表示要删除元素的位置iterator erase(iterator _First, iterator _First)第一个被删除的元素的位置iterator erase(iterator _First, itera
2012-02-21 14:37:14 7742 1
原创 set:: begin ,clear, count, empty, end, equal_range
set::beginconst_iterator begin() const;terator begin() ;功能:返回第一个元素的双向定位器(iterator)的地址。说明:当返回的第一个元素的地址值为一个常值定位器(_iterator),则set不会被修改。当返回的第一个元素的地址值为一个定位器(iterator),则set可被修改。
2012-02-21 14:25:10 1108
原创 set:: get_allocator
功能:返回一个构造该set容器的allocator 的一个副本。用法:Allocator get_allocator() const;说明:容器set的allocator 指明一个类的存储管理。默认的allocator能提供STL容器高效的运行。函数返回值:返回该容器的allocator 。//用ctr的 allocator 来创建ctr
2012-02-21 13:45:07 676
原创 set::vale_comp
功能:返回一个能确定元素的次序的函数语法:value_compare value_comp() const;说明:它是根据关键字的值key来确定元素的次序的。函数返回值:返回一个能确定元素的次序的函数#include #include using namespace std; int main()
2012-02-21 13:33:49 509
原创 set::max_size
功能:计算set容器的最大长度语法:size_type max_size() const;说明:max_size 会返回set容器的可能的最大长度。ex:#include#include using namespace std;#define len 5int main(){ set ctr; set::size_type st; in
2012-02-20 14:56:26 660
原创 set:: lower_bound
功能:求出指向第一个关键字的值是大于等于一个给定值的元素的定位器。语法:iterator lower_bound( const Key &_Key);const_iterator lower_bound( const Key &_Key) const;说明:_Key 是一个用于排序的关键字ex:#include
2012-02-20 14:48:30 2491
原创 set::key_comp
功能:取得一个比较对象的副本来对set容器中的元素排序、语法:key_compare key_comp() const;说明:存储对象定义了一个成员函数;bool operator(const Key &_Left, const Key _Right)当_Left 严格在 _Right 的前面时,返回true, 否则返回false。函
2012-02-20 14:22:50 794
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人