导航

上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页

2016年4月13日

摘要: 13.44:编写标准库string类的简化版本,命名为String。你的类应该至少有一个默认构造函数和一个接受C 风格字符串指针参数的构造函数。使用allocator为你的String类分配所需内存 String.h头文件 主函数验证 阅读全文

posted @ 2016-04-13 20:21 CSU蛋李 阅读(173) 评论(0) 推荐(0) 编辑

摘要: C++primer 练习13.39 编写你自己版本的StrVec,包括自己版本的reserve,capacity(参见9.4节,第318页)和resize(参见9.3.5节,第314页) 13.40 为你的StrVec类添加一个构造函数,它接受一个initializer_list 阅读全文

posted @ 2016-04-13 19:33 CSU蛋李 阅读(330) 评论(0) 推荐(0) 编辑

摘要: #pragma once #include #include using namespace std; class Message { friend class Folder; friend void swap(Message &lhs, Message &rhs); public: explicit Message(const string &str=""):cont... 阅读全文

posted @ 2016-04-13 17:00 CSU蛋李 阅读(214) 评论(0) 推荐(0) 编辑

摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文

posted @ 2016-04-13 14:51 CSU蛋李 阅读(96) 评论(0) 推荐(0) 编辑

摘要: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 阅读全文

posted @ 2016-04-13 14:50 CSU蛋李 阅读(91) 评论(0) 推荐(0) 编辑

摘要: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 采用三 阅读全文

posted @ 2016-04-13 14:40 CSU蛋李 阅读(90) 评论(0) 推荐(0) 编辑

2016年4月12日

摘要: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 给一个数n,看他的阶乘中最后有几个0 10是由5 阅读全文

posted @ 2016-04-12 23:59 CSU蛋李 阅读(107) 评论(0) 推荐(0) 编辑

2016年4月10日

摘要: // 12_27.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include #include #include #include #include #include using namespace std; //提前声明类QueryResult,在书中说必须提前声明,然而vs2015中 //仅声明友元... 阅读全文

posted @ 2016-04-10 21:51 CSU蛋李 阅读(228) 评论(0) 推荐(0) 编辑

2016年4月8日

摘要: 编写函数,返回一个动态分配的int的vector。将此vector传递给另一个函数,这个函数读取标准输入,将读入的值 保存在vector元素中。再将vector传递给另一个函数,打印读入的值。记得在恰当的时刻delete vector 阅读全文

posted @ 2016-04-08 01:23 CSU蛋李 阅读(149) 评论(0) 推荐(0) 编辑

2016年4月5日

摘要: // 11_33.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include #include #include using namespace std; //用map文件来建立一个要转换的字符串对应的转换成的字符串 map buildMap(ifstream &map_file) { map ma; ... 阅读全文

posted @ 2016-04-05 18:21 CSU蛋李 阅读(200) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页