原创 CHAPTER 04:EX 07

//7. Make a Stash that holds doubles. Fill it with 25 double//values, then print them out to the console.#ifndef SOLUT

原创 CHAPTER 04:EX 25

25. Repeat Exercise 24, but put the functions inside a structinstead of using “raw” structs and functions. #ifndef SO

原创 TICPP CHAPTER 11 EX 27 & EX28

/* 27. Start with FunctionTable.cpp from Chapter 3. Create a class that contains a vector of pointers to functions, wi

原创 前一段時間很紅的金山3題

1、編程計算從 1 到 2008080808 之間的整數有多少個含有數字7。 2、結構RECT可以表示一個平面上的矩形區域: struct RECT {   int left, right, top, bottom; }; 編程計算兩個

原创 C++編程思想 第二卷 勘誤

注:這是我本人在看C++編程思想 第二卷:實用編程技術(刁成嘉譯)時發現的翻譯問題。特此列一表,供各位參考及討論 。 本人收集的翻譯不妥之處大部分爲那些狗屁不通之句,影響讀者理解之句以及誤人子弟之句。關於名詞翻譯的修改較少,希望能夠給各位

原创 CHAPTER 10:EX 19

/* 19. Modify FriendInjection.cpp to add a definition for the friend function and to call the function inside main( ).

原创 CHAPTER 05:EX 05

/*5. Create three classes. The first class contains private data,and grants friendship to the entire second class and 

原创 CHAPTER 07:EX 01

/**//*1.Create a Text class that contains a string object to hold the text of a file. Give it two constructors: a defa

原创 CHAPTER 03:EX 27

/27. Create a const array of double and a volatile array of//double. Index through each array and use const_cast to//c

原创 CHAPTER 04:EX 18

/*18. Write a function that takes a char* argument. Using new,dynamically allocate an array of char that is the size o

原创 關於指針引用

  如果修改指針的指向,而非指針所指向的內存空間的內容? 先看看下面這段代碼 void f1(int* ip) {     ip = new int(10); } 如果傳入一個int* 指針,比如這樣 int* p; f1(p);

原创 CHAPTER 10:EX 24

#ifndef BOB_H#define BOB_Hnamespace bob{  class Widget { /* ... */ };  class Poppit { /* ... */ };  // ...}#endif    /

原创 CHAPTER 10:EX 34

#ifndef MIRROR_H#define MIRROR_Hclass Mirror ...{    Mirror *next;    bool flag;public:    Mirror():flag(true),next(0)

原创 CHAPTER 05:EX 04

/*4. Write two classes, each of which has a member functionthat takes a pointer to an object of the other class. Creat

原创 CHAPTER 04:EX 24

24. Create a struct that holds an int and a pointer to anotherinstance of the same struct. Write a function that takest