C++Primer6thExe
文章平均质量分 68
头像是我的偶像
这个作者很懒,什么都没留下…
展开
-
c++_primer_exercise_1911_1912
Exercise 19.11:Normally a pointer points to an object, but a pointer to member identifies a member of class, not an object of that class.Exercise 19.12#ifndef SCREEN_H#define SCREEN_H原创 2015-03-13 14:51:00 · 389 阅读 · 0 评论 -
c++_primer_exercise_1632_1633_1634
Exercise 16.32:The compiler examines the types of the argument that were specified using a template parameter. It automatically instantiates a version of the function with those types or values bo原创 2015-02-26 13:28:48 · 488 阅读 · 0 评论 -
c++_primer_exercise_1619_1620
/*********************************************** * IDE: VS2010 * FILE: print_container.h ***********************************************/#ifndef PRINT_CONTAINER_H#define PRINT_CONTAINER_H原创 2015-02-25 16:20:27 · 406 阅读 · 0 评论 -
c++_primer_exercise_1601_1604
Exercise 16.1:instantiation: class or function generated by the compiler from a template.Exercise 16.4:#include using std::vector;#include using std::begin; using std::end;#include原创 2015-02-10 19:11:37 · 484 阅读 · 0 评论 -
c++_primer_exercise_13333435363738
/********************************************** * IDE: VS2010 * FILE: Folder.h *********************************************/#ifndef FOLDER_H_#define FOLDER_H_#include #include //原创 2015-01-22 11:05:37 · 743 阅读 · 0 评论 -
c++_primer_exercise_1331
Give your class a #include using std::string;#include #include using std::vector;#include using std::sort;class Has_ptr{ friend void swap(Has_ptr &, Has_ptr &);public: // c原创 2015-01-21 10:18:35 · 497 阅读 · 0 评论 -
c++_primer_exercise_1531_Query
code:/*************************************************** * IDE: VS2010 * FILE: Text_query.h ***************************************************/#ifndef TEXT_QUERY_H#define TEXT_QUERY_H原创 2015-02-08 12:37:36 · 496 阅读 · 0 评论 -
c++_primer_exercise_130608
Exercise 13.6:Overload operators are functions that have the name operator followed by the symbol for the operator being defined. Hence,the assignment operator is a function named operator=. Jus原创 2015-01-19 14:35:34 · 443 阅读 · 0 评论 -
c++_primer_exercise_13010205
Exercise 13.1:copy constructor: Constructor that initializes a new object as a copy of another object of the same type. The copy constructor is applied implicitly to pass object to or from a funct原创 2015-01-19 13:37:20 · 470 阅读 · 0 评论 -
c++_primer_exercise_1227...
A simple text-query program. Our program will let a user search a given file for words that might occur in it. The result of a query will be the number of times the word occurs and a list of lines on原创 2015-01-18 19:34:56 · 475 阅读 · 0 评论 -
c++_primer_exercise_1526
// by default, the base-class default constructor initializes the base-class// part of a derived object. If we want copy (or move) the base-class part,// we must explicitly use the copy (or move)原创 2015-02-05 19:16:53 · 722 阅读 · 0 评论 -
c++_primer_exercise_1339
/*********************************************** * IDE: VS2010 * FILE: Str_vec.h ***********************************************/#ifndef STR_VEC_H#define STR_VEC_H#include #include /原创 2015-01-23 16:07:23 · 517 阅读 · 0 评论 -
c++_primer_exercise_1609_1610_1611_1612_1613_1614_1615
Exercise 16.9:function template --> Definition from which specific functions can be instantiated. A function template is defined using thetemplate keyword followed by a comma-separated list of one原创 2015-02-12 19:44:34 · 534 阅读 · 0 评论 -
c++_primer_exercise_1345
Exercise 13.45:Functions that return lvalue references, along with the assignment, subscript, deference, and prefix increment/decrement operators, are all examples of expressions that return lvalue.原创 2015-01-24 11:58:43 · 518 阅读 · 0 评论 -
c++_primer_exercise_1903_1904_1905
Exercise 19.3:(b) fail. Exercise 19.4:try{C &rc = dynamic_cast(*pa);}catch (bad_cast){// handle the fact that the cast failed}Exercise 19.5:the dynamic_cast and typei原创 2015-03-12 18:01:14 · 439 阅读 · 0 评论 -
c++_primer_exercise_1739
#include using std::cerr; using std::endl;#include using std::fstream;#include using std::string;int main(){ // open for input and output and preposition file pointers to end-of-原创 2015-03-04 18:29:25 · 410 阅读 · 0 评论 -
c++_primer_exercise_1731_1732
code:#include using std::default_random_engine;using std::bernoulli_distribution;#include using std::string;#include using std::cin; using std::cout; using std::endl;int main()原创 2015-03-03 13:52:47 · 502 阅读 · 0 评论 -
c++_primer_exercise_1653
/****************************************************************** * IDE: VS2013(maybe VS2010 not support variadic template) ******************************************************************/#原创 2015-03-01 10:22:44 · 358 阅读 · 0 评论 -
c++_primer_exercise_1724_1725_1726_1728
/**************************************************** * IDE: VS2010 ****************************************************/#include using std::cin; using std::cout; using std::endl;#include原创 2015-03-02 18:46:31 · 482 阅读 · 0 评论 -
c++_primer_exercise_1728_1729_1730
/************************************************* * IDE: VS2010 *************************************************/#include using std::cin; using std::cout; using std::endl;#include usin原创 2015-03-03 10:20:07 · 409 阅读 · 0 评论 -
c++_primer_exercise_1719_1720
exercise 17.19:str() Returns a string containing the matched portion of the input. Returns the empty string if matched is false. So, it is not necessary to check whether m[4] was matched.原创 2015-03-02 15:19:26 · 546 阅读 · 0 评论 -
c++_primer_exercise_1648_1650
原创 2015-02-28 11:12:47 · 350 阅读 · 0 评论 -
c++_primer_exercise_1704
Exercise 17.4:/***************************************************** * IDE: VS2010 * FILE: find_book.cpp *****************************************************/#include using std::tuple;原创 2015-02-27 10:22:33 · 423 阅读 · 0 评论 -
c++_primer_exercise_1717_1718
#include using std::regex; using std::sregex_iterator;#include using std::string;#include using std::cout; using std::endl;int main(){ // find the characters ei that follow a chara原创 2015-02-28 18:35:15 · 456 阅读 · 0 评论 -
c++_primer_exercise_1226
Using an allocator:/********************************************************* * IDE: VS2013 *********************************************************/#include using std::allocator;#inc原创 2015-01-17 12:24:46 · 423 阅读 · 0 评论 -
c++_primer_exercise_121920
Str_blob && Str_blob_ptr/**************************************** * IDE: VS2010 ****************************************/#include using std::shared_ptr; using std::make_shared; using std::原创 2015-01-16 14:33:59 · 346 阅读 · 0 评论 -
c++_primer_exercise_1037
8Given a vector that has ten elements, copy the elements from position 3 through 7 in reverse order to a list.原创 2015-01-10 23:43:56 · 461 阅读 · 0 评论 -
c++_primer_exercise_1124
What does the following program do?map m;m[0] = 1;answer:m is searched for the element whose key is 0. The element is not found.A new key-value pair is inserted into m. The key is a const原创 2015-01-13 09:40:53 · 473 阅读 · 0 评论 -
c++_primer_exercise_1107
Define a map for which the key is the family's last name and the value is a vector of the children's names. Write code to add new families and to add new children to an existing family.co原创 2015-01-12 13:02:33 · 430 阅读 · 0 评论 -
c++_primer_exercise_1033
#include // for ifstream && ofstream#include // for stream iteratorusing namespace std;int main(void){ fstream in_file("integers", ofstream::out); ofstream odd_out_file("odd_output原创 2015-01-10 17:37:32 · 346 阅读 · 0 评论 -
c++_primer_exercise_1103
a word-counting program:原创 2015-01-12 10:52:48 · 437 阅读 · 0 评论 -
c++_primer_exercise_1442
/******************************************************************* * IDE: VS2010 * FILE: exercise_1442.cpp *******************************************************************/#include usi原创 2015-01-29 14:04:20 · 427 阅读 · 0 评论 -
c++_primer_exercise_1444
Look inside the code, maybe vs2010 not support function pointer as callable object completely./*********************************************************** * IDE: VS2010 * FILE: exercise_1444.原创 2015-01-29 16:59:05 · 387 阅读 · 0 评论 -
c++_primer_exercise_1406_1409_1410
/***************************************************** * IDE: VS2010 * FILE: Sales_data.h *****************************************************/#ifndef SALES_DATA_H#define SALES_DATA_H#原创 2015-01-26 18:42:50 · 444 阅读 · 0 评论 -
c++_primer_exercise_1438_1439
/********************************************** * IDE: VS2013 * FILE: exercise_1438.cpp **********************************************/#include using std::string;#include using std::map原创 2015-01-27 22:26:49 · 392 阅读 · 0 评论 -
c++_primer_exercise_1435_1436
/*********************************************** * IDE: VS2010 * FILE: exercise_1435_1436.cpp ***********************************************/#include using std::string;#include using s原创 2015-01-27 18:07:23 · 406 阅读 · 0 评论 -
c++_primer_exercise_1118
A small word_counting program using map iterator./********************************************** * IDE: vs2013 **********************************************/#include #include #include原创 2015-01-12 21:19:03 · 448 阅读 · 0 评论 -
c++_primer_exercise_1112
Write a program to read a sequence of strings and ints, storing each into a pair. Store the pairs in a vector.#include // for pair#include #include #include using namespace std;int原创 2015-01-12 15:58:34 · 459 阅读 · 0 评论 -
c++_primer_exercise_1114
Extend the map of children to their family name that you wrote for the exercise 11.07 by having the vector store a pair that holds a child's name and birthday./************************************原创 2015-01-12 16:23:55 · 459 阅读 · 0 评论 -
c++_primer_exercise_1518_1519_1520
Exercise 15.18 15.19 15.20:class Base{public: void pub_mem(); void memfcn(Base &b) { b = *this; }protected: int prot_mem;private: char priv_mem;};class Pub_drev : public Base原创 2015-02-04 11:26:23 · 969 阅读 · 0 评论