- 博客(33)
- 收藏
- 关注
原创 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 382
原创 c++_primer_exercise_1442
/******************************************************************* * IDE: VS2010 * FILE: exercise_1442.cpp *******************************************************************/#include usi
2015-01-29 14:04:20 420
原创 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 389
原创 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 400
原创 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 436
原创 c++_primer_exercise_1402
/***************************************************** * IDE: VS2010 * FILE: Sales_data.h *****************************************************/#ifndef SALES_DATA_H#define SALES_DATA_H#
2015-01-26 15:49:59 453
原创 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 513
原创 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 513
原创 c++_primer_exercise_13333435363738
/********************************************** * IDE: VS2010 * FILE: Folder.h *********************************************/#ifndef FOLDER_H_#define FOLDER_H_#include #include //
2015-01-22 11:05:37 690
原创 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 492
原创 default constructor, copy constructor, copy assignment operator, destructor
constructor:a special member function used to initialize objects. Each constructor should give each data member a well defined initial value.synthesized default constructor:the default constru
2015-01-20 10:13:40 549
原创 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 437
原创 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 463
原创 C++PrimerThinking
1.The fact that the copy constructor is used to initialize nonreference parameters of class type explains why the copy constructor’s own parameter must be a reference. If that parameter were not a ref
2015-01-19 10:07:11 349
原创 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 470
原创 c++_primer_exercise_1226
Using an allocator:/********************************************************* * IDE: VS2013 *********************************************************/#include using std::allocator;#inc
2015-01-17 12:24:46 419
原创 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 332
原创 pick up
1. When we use a smart pointer, the smart pointer class ensures that memory is freed when it is no longer needed even if the block is exited prematurely due to an exception. In contrast, memory that w
2015-01-16 00:23:08 387
原创 c++_primer_exercise_1210
Answer to Exercise 12.10:In this call, we passed a temporary shared_ptr to process. That temporary is destroyed when the expression in which the call appears finishes. Destroying the temporary decre
2015-01-15 23:36:51 389
原创 Managing Dynamic Memory Is Error-prone
There are three common programs with using and delete to manage dynamic
2015-01-15 16:20:42 513
原创 Conventions
There are a number of generally accepted conventions for naming variables. Following these conventions can improve the readability of a program.An identifier should give some indication of its m
2015-01-15 16:05:04 453
原创 c++_primer_exercise_11333435
Write a program that, given one string, transforms it into another. The input to our program is two files. The first file contains rules that we will use to transform the text in the second file. Each
2015-01-13 19:23:03 323
原创 c++_primer_exercise_113132
write a program that defines a multimap of authors and their works. Use find to find an element in the multimap and erase that element. Be sure your program works correctly if the element you look for
2015-01-13 15:14:01 388
原创 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 464
原创 c++_primer_exercise_1123
Rewrite the map that stored vectors of children's names with a key that is the family last name to use a multimap./*********************************************** IDE: vs2013******************
2015-01-12 23:06:20 510
原创 c++_primer_exercise_1120
For the containers that have unique keys, the versions of insert and emplace that add a single element return a pair that lets us know whether the insertion happed. The first member of the pair is an
2015-01-12 22:36:29 456
原创 c++_primer_exercise_1118
A small word_counting program using map iterator./********************************************** * IDE: vs2013 **********************************************/#include #include #include
2015-01-12 21:19:03 441
原创 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 454
原创 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 454
原创 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 425
原创 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 455
原创 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 339
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人