Skip to content

Commit

Permalink
format for comma like : 1,2,3,4 => 1, 2, 3, 4
Browse files Browse the repository at this point in the history
	modified:   ../ch07/ex7_11.h
	modified:   ../ch07/ex7_12.h
	modified:   ../ch07/ex7_21.h
	modified:   ../ch07/ex7_23.h
	modified:   ../ch07/ex7_24.h
	modified:   ../ch07/ex7_26.h
	modified:   ../ch07/ex7_27.h
	modified:   ../ch07/ex7_32.h
	modified:   ../ch07/ex7_41.h
	modified:   ../ch09/ex9_45.cpp
	modified:   ../ch09/ex9_51.cpp
	modified:   ../ch10/ex10_03_04.cpp
	modified:   ../ch10/ex10_09.cpp
	modified:   ../ch10/ex10_11.cpp
	modified:   ../ch10/ex10_16.cpp
	modified:   ../ch10/ex10_18_19.cpp
	modified:   ../ch10/ex10_25.cpp
	modified:   ../ch10/ex10_27.cpp
	modified:   ../ch10/ex10_28.cpp
	modified:   ../ch10/ex10_34_35_36_37.cpp
	modified:   ../ch11/ex11_20.cpp
	modified:   ../ch11/ex11_3_4.cpp
	modified:   ../ch11/ex11_7.cpp
	modified:   ../ch11/ex11_9_10.cpp
	modified:   ../ch14/ex14_02.h
	modified:   ../ch14/ex14_22.h
	modified:   ../ch14/ex14_37.cpp
	modified:   ../ch14/ex14_45.h
	modified:   ../ch15/ex15.11/bulk_quote.h
	modified:   ../ch15/ex15.11/limit_quote.h
	modified:   ../ch15/ex15.12.13.14/bulk_quote.h
	modified:   ../ch15/ex15.12.13.14/limit_quote.h
	modified:   ../ch15/ex15.12.13.14/main.cpp
	modified:   ../ch15/ex15.15.16.17/bulk_quote.h
	modified:   ../ch15/ex15.15.16.17/limit_quote.h
	modified:   ../ch15/ex15.21.22/main.cpp
	modified:   ../ch15/ex15.26/limit_quote.h
	modified:   ../ch15/ex15.27/bulk_quote.h
	modified:   ../ch15/ex15.27/limit_quote.h
	modified:   ../ch15/ex15.27/main.cpp
	modified:   ../ch15/ex15.28.29/bulk_quote.h
	modified:   ../ch15/ex15.28.29/limit_quote.h
	modified:   ../ch15/ex15.30/bulk_quote.h
	modified:   ../ch15/ex15.30/limit_quote.h
	modified:   ../ch15/ex15.30/quote.cpp
	modified:   ../ch15/ex15.30/quote.h
	modified:   ../ch15/ex15.34.35.36.38/andquery.h
	modified:   ../ch15/ex15.34.35.36.38/textquery.cpp
	modified:   ../ch15/ex15.39.40/andquery.h
	modified:   ../ch15/ex15.39.40/orquery.cpp
	modified:   ../ch15/ex15.39.40/textquery.cpp
	modified:   ../ch15/ex15.4.5.6/bulk_quote.h
	modified:   ../ch15/ex15.42_b/textquery.cpp
	modified:   ../ch15/ex15.42_c/queryresult.cpp
	modified:   ../ch15/ex15.42_c/textquery.cpp
	modified:   ../ch15/ex15.7/bulk_quote.h
	modified:   ../ch15/ex15.7/limit_quote.h
	modified:   ../ch15/ex15.7/main.cpp
	modified:   ../ch16/ex16.12.13/Blob.h
	modified:   ../ch16/ex16.14.15/Screen.h
	modified:   ../ch16/ex16.14.15/main.cpp
	modified:   ../ch16/ex16.16/main.cpp
	modified:   ../ch16/ex16.16/vec.h
	modified:   ../ch16/ex16.21.22/wy_textquery.cpp
	modified:   ../ch16/ex16.21.22/wy_textquery.h
	modified:   ../ch16/ex16.24/Blob.h
	modified:   ../ch16/ex16.24/main.cpp
	modified:   ../ch16/ex16.28/unique_pointer.h
	modified:   ../ch16/ex16.29/Blob.h
	modified:   ../ch16/ex16.29/unique_pointer.h
	modified:   ../ch16/ex16.32.33.34.35.36/main.cpp
	modified:   ../ch16/ex16.42.43.44.45.46/main.cpp
	modified:   ../ch16/ex16.47/main.cpp
	modified:   ../ch16/ex16.51.52/main.cpp
	modified:   ../ch16/ex16.56.57/main.cpp
	modified:   ../ch16/ex16.58.59/strvec.cpp
	modified:   ../ch16/ex16.58.59/vec.h
	modified:   ../ch17/ex17.3/main.cpp
	modified:   ../ch17/ex17.3/textquery.cpp
	modified:   ../ch17/ex17_10.cpp
	modified:   ../ch17/ex17_28_29_30.cpp

 Untracked files:
	format.rb
  • Loading branch information
Mooophy committed Aug 27, 2015
1 parent af6f34e commit 49bc33d
Show file tree
Hide file tree
Showing 81 changed files with 136 additions and 136 deletions.
2 changes: 1 addition & 1 deletion ch07/ex7_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
struct Sales_data {
Sales_data() = default;
Sales_data(const std::string &s):bookNo(s) {}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data(std::istream &is);

std::string isbn() const { return bookNo; };
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_12.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::istream &read(std::istream&, Sales_data&);
struct Sales_data {
Sales_data() = default;
Sales_data(const std::string &s):bookNo(s) {}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data(std::istream &is) { read(is, *this);}

std::string isbn() const { return bookNo; };
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_21.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Sales_data {
public:
Sales_data() = default;
Sales_data(const std::string &s):bookNo(s) {}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data(std::istream &is) { read(is, *this);}

std::string isbn() const { return bookNo; };
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_23.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Screen {
using pos = std::string::size_type;

Screen() = default;
Screen(pos ht, pos wd, char c):height(ht),width(wd),contents(ht*wd, c){}
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){}

char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_24.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Screen {

Screen() = default; // 1
Screen(pos ht, pos wd):height(ht),width(wd),contents(ht*wd, ' '){} // 2
Screen(pos ht, pos wd, char c):height(ht),width(wd),contents(ht*wd, c){} // 3
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){} // 3

char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_26.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Sales_data {
public:
Sales_data() = default;
Sales_data(const std::string &s):bookNo(s) {}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data(std::istream &is) { read(is, *this); }

std::string isbn() const { return bookNo; };
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_27.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Screen {

Screen() = default; // 1
Screen(pos ht, pos wd):height(ht),width(wd),contents(ht*wd, ' '){} // 2
Screen(pos ht, pos wd, char c):height(ht),width(wd),contents(ht*wd, c){} // 3
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){} // 3

char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Screen {

Screen() = default; // 1
Screen(pos ht, pos wd):height(ht),width(wd),contents(ht*wd, ' '){} // 2
Screen(pos ht, pos wd, char c):height(ht),width(wd),contents(ht*wd, c){} // 3
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){} // 3

char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }
Expand Down
2 changes: 1 addition & 1 deletion ch07/ex7_41.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Sales_data {
friend Sales_data add(const Sales_data &lhs, const Sales_data &rhs);

public:
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p)
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p)
{ std::cout << "Sales_data(const std::string&, unsigned, double)" << std::endl; }

Sales_data() : Sales_data("", 0, 0.0f)
Expand Down
2 changes: 1 addition & 1 deletion ch09/ex9_45.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @author @TungWah @Yue Wang
// @date 4 Oct,2014.
// @date 4 Oct, 2014.
//
// Exercise 9.45:
// Write a funtion that takes a string representing a name and two other
Expand Down
2 changes: 1 addition & 1 deletion ch09/ex9_51.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class My_date{
format = 0x01;
}

// January 1,1900 or Jan 1, 1900
// January 1, 1900 or Jan 1, 1900
if((s.find_first_of(',') >= 4) && s.find_first_of(',')!= string :: npos){
format = 0x10;
}
Expand Down
2 changes: 1 addition & 1 deletion ch10/ex10_03_04.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main()
// The ouput is 4 rather than 4.9 as expected.
// The reason is std::accumulate is a template function. The third parameter is _Tp __init
// When "0" , an integer, had been specified here, the compiler deduced _Tp as
// interger.As a result ,when the following statments were being excuted :
// interger.As a result , when the following statments were being excuted :
// for (; __first != __last; ++__first)
// __init = __init + *__first;
// return __init;
Expand Down
2 changes: 1 addition & 1 deletion ch10/ex10_09.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>
#include <algorithm>

// print containers like vector,deque, list, etc.
// print containers like vector, deque, list, etc.
template<typename Sequence>
auto println(Sequence const& seq) -> std::ostream&
{
Expand Down
4 changes: 2 additions & 2 deletions ch10/ex10_11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <numeric>
#include <list>

// print a container like vector,deque, list,etc.
// print a container like vector, deque, list, etc.
template<typename Sequence>
inline std::ostream& println(Sequence const& seq)
{
Expand All @@ -33,7 +33,7 @@ is_shorter(std::string const& lhs, std::string const& rhs)
void elimdups(std::vector<std::string> &vs)
{
std::sort(vs.begin(), vs.end());
auto new_end = std::unique(vs.begin(),vs.end());
auto new_end = std::unique(vs.begin(), vs.end());
vs.erase(new_end, vs.end());
}

Expand Down
8 changes: 4 additions & 4 deletions ch10/ex10_16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
void elimdups(std::vector<std::string> &vs)
{
std::sort(vs.begin(), vs.end());
auto new_end = std::unique(vs.begin(),vs.end());
auto new_end = std::unique(vs.begin(), vs.end());
vs.erase(new_end, vs.end());
}

Expand All @@ -26,12 +26,12 @@ void biggies(std::vector<std::string> &vs, std::size_t sz)
elimdups(vs);

// sort by size, but maintain alphabetical order for same size.
std::stable_sort(vs.begin(), vs.end(),[](string const& lhs, string const& rhs){
std::stable_sort(vs.begin(), vs.end(), [](string const& lhs, string const& rhs){
return lhs.size() < rhs.size();
});

// get an iterator to the first one whose size() is >= sz
auto wc = std::find_if(vs.begin(), vs.end(),[sz](string const& s){
auto wc = std::find_if(vs.begin(), vs.end(), [sz](string const& s){
return s.size() >= sz;
});

Expand All @@ -49,7 +49,7 @@ int main()
"1234","1234","1234","hi~", "alan", "alan", "cp"
};
std::cout << "ex10.16: ";
biggies(v,3);
biggies(v, 3);
std::cout << std::endl;

return 0;
Expand Down
10 changes: 5 additions & 5 deletions ch10/ex10_18_19.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
void elimdups(std::vector<std::string> &vs)
{
std::sort(vs.begin(), vs.end());
auto new_end = std::unique(vs.begin(),vs.end());
auto new_end = std::unique(vs.begin(), vs.end());
vs.erase(new_end, vs.end());
}

Expand All @@ -31,7 +31,7 @@ void biggies_partition(std::vector<std::string> &vs, std::size_t sz)
{
elimdups(vs);

auto pivot = partition(vs.begin(), vs.end(),[sz](const std::string &s){
auto pivot = partition(vs.begin(), vs.end(), [sz](const std::string &s){
return s.size() >= sz;}
);

Expand All @@ -45,7 +45,7 @@ void biggies_stable_partition(std::vector<std::string> &vs, std::size_t sz)
{
elimdups(vs);

auto pivot = stable_partition(vs.begin(), vs.end(),[sz](const std::string& s){
auto pivot = stable_partition(vs.begin(), vs.end(), [sz](const std::string& s){
return s.size() >= sz;
});

Expand All @@ -63,13 +63,13 @@ int main()

std::cout << "ex10.18: ";
std::vector<std::string> v1(v);
biggies_partition(v1,4);
biggies_partition(v1, 4);
std::cout << std::endl;

// ex10.19
std::cout << "ex10.19: ";
std::vector<std::string> v2(v);
biggies_stable_partition(v2,4);
biggies_stable_partition(v2, 4);
std::cout << std::endl;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion ch10/ex10_25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using namespace std::placeholders;
void elimdups(vector<string> &vs)
{
std::sort(vs.begin(), vs.end());
vs.erase(unique(vs.begin(),vs.end()), vs.end());
vs.erase(unique(vs.begin(), vs.end()), vs.end());
}

bool check_size(const string &s, string::size_type sz)
Expand Down
2 changes: 1 addition & 1 deletion ch10/ex10_27.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

int main()
{
std::vector<int> vec{1,1,3,3,5,5,7,7,9};
std::vector<int> vec{1, 1, 3, 3, 5, 5, 7, 7, 9};
std::list<int> lst;

std::unique_copy(vec.begin(), vec.end(), back_inserter(lst));
Expand Down
2 changes: 1 addition & 1 deletion ch10/ex10_28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void print(Sequence const& seq)

int main()
{
std::vector<int> vec{1,2,3,4,5,6,7,8,9};
std::vector<int> vec{1, 2, 3, 4, 5, 6, 7, 8, 9};

// uses inserter
list<int> lst1;
Expand Down
4 changes: 2 additions & 2 deletions ch10/ex10_34_35_36_37.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ int main()
// 10.37
std::list<int> ret_lst;
std::copy(vec.crbegin() + 3, vec.crbegin() + 8, std::back_inserter(ret_lst));
// 0,1,2,3,4,5,6,7,8,9
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
// ^ ^
// rend rbegin
// @note: std::copy copies the range [first,last) into result.
// @note: std::copy copies the range [first, last) into result.
// hence, the arguments here denote:
// [6 5 4 3 2 1)
// ^ this one is specified but not included.
Expand Down
2 changes: 1 addition & 1 deletion ch11/ex11_20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main()
string word;
while(std::cin >> word)
{
auto ret = word_count.insert({word,1});
auto ret = word_count.insert({word, 1});
if(!ret.second) ++ret.first->second;
}

Expand Down
2 changes: 1 addition & 1 deletion ch11/ex11_3_4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// Exercise 11.4:
// Extend your program to ignore case and punctuation.
// For example, “example.” “example,” and “Example” should
// For example, “example.” “example, ” and “Example” should
// all increment the same counter.
//

Expand Down
2 changes: 1 addition & 1 deletion ch11/ex11_7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main()
return std::cin>>lastName && lastName != "@q";
}())
// ^^
// the () used here is to call the lambda ,otherwise it does not work
// the () used here is to call the lambda , otherwise it does not work
// go to the post on stack overflow for more detail.

{
Expand Down
8 changes: 4 additions & 4 deletions ch11/ex11_9_10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// Could we define a map from vector<int>::iterator
// to int? What about from list<int>::iterator to int?
// In each case, if not, why not?
// vector<int>::iterator to int is ok ,because < is defined
// list<int>::iterator to int is not ok,as no < is defined.
// vector<int>::iterator to int is ok , because < is defined
// list<int>::iterator to int is not ok, as no < is defined.
#include <iostream>
#include <map>
#include <string>
Expand All @@ -28,12 +28,12 @@ int main()


std::vector<int> vi;
mv.insert(std::pair<std::vector<int>::iterator, int>(vi.begin(),0));
mv.insert(std::pair<std::vector<int>::iterator, int>(vi.begin(), 0));

// but when using this one the compiler complained that
// error: no match for 'operator<' in '__x < __y'
std::list<int> li;
ml.insert(std::pair<std::list<int>::iterator,int>(li.begin(),0));
ml.insert(std::pair<std::list<int>::iterator, int>(li.begin(), 0));

return 0;
}
2 changes: 1 addition & 1 deletion ch14/ex14_02.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Sales_data {
friend Sales_data operator+(const Sales_data&, const Sales_data&); // addition

public:
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data() : Sales_data("", 0, 0.0f){}
Sales_data(const std::string &s) : Sales_data(s, 0, 0.0f){}
Sales_data(std::istream &is);
Expand Down
2 changes: 1 addition & 1 deletion ch14/ex14_22.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Sales_data {
friend Sales_data operator+(const Sales_data&, const Sales_data&);

public:
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data() : Sales_data("", 0, 0.0f){}
Sales_data(const std::string &s) : Sales_data(s, 0, 0.0f){}
Sales_data(std::istream &is);
Expand Down
2 changes: 1 addition & 1 deletion ch14/ex14_37.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class IsEqual {

int main()
{
std::vector<int> vec = {3,2,1,4,3,7,8,6};
std::vector<int> vec = {3, 2, 1, 4, 3, 7, 8, 6};
std::replace_if(vec.begin(), vec.end(), IsEqual(3), 5);
for (int i : vec) std::cout << i << " ";
std::cout << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion ch14/ex14_45.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Sales_data {
friend Sales_data operator+(const Sales_data&, const Sales_data&);

public:
Sales_data(const std::string &s, unsigned n, double p):bookNo(s),units_sold(n),revenue(n*p){}
Sales_data(const std::string &s, unsigned n, double p):bookNo(s), units_sold(n), revenue(n*p){}
Sales_data() : Sales_data("", 0, 0.0f){}
Sales_data(const std::string &s) : Sales_data(s, 0, 0.0f){}
Sales_data(std::istream &is);
Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.11/bulk_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Bulk_quote : public Quote
public:
Bulk_quote() = default;
Bulk_quote(const std::string& b, double p, std::size_t q, double disc) :
Quote(b,p), min_qty(q), discount(disc) { }
Quote(b, p), min_qty(q), discount(disc) { }

double net_price(std::size_t n) const override;
void debug() const override;
Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.11/limit_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Limit_quote : public Quote
public:
Limit_quote();
Limit_quote(const std::string& b, double p, std::size_t max, double disc):
Quote(b,p), max_qty(max), discount(disc) { }
Quote(b, p), max_qty(max), discount(disc) { }

double net_price(std::size_t n) const override
{ return n * price * (n < max_qty ? 1 - discount : 1 ); }
Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.12.13.14/bulk_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Bulk_quote : public Quote
public:
Bulk_quote() = default;
Bulk_quote(const std::string& b, double p, std::size_t q, double disc) :
Quote(b,p), min_qty(q), discount(disc) { }
Quote(b, p), min_qty(q), discount(disc) { }

double net_price(std::size_t n) const override;
void debug() const override;
Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.12.13.14/limit_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Limit_quote : public Quote
public:
Limit_quote();
Limit_quote(const std::string& b, double p, std::size_t max, double disc):
Quote(b,p), max_qty(max), discount(disc) { }
Quote(b, p), max_qty(max), discount(disc) { }

double net_price(std::size_t n) const override
{ return n * price * (n < max_qty ? 1 - discount : 1 ); }
Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.12.13.14/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class derived : public base
void print(std::ostream &os) { base::print(os); os << " derived\n " << i; }
// ^^^^^ ^^^^^^ -- added to fix this problem
// this print wanted to call the print from the base class.
// however,the class scope base:: was omitted.As a result
// however, the class scope base:: was omitted.As a result
// it will cause an infinit recursion.


Expand Down
2 changes: 1 addition & 1 deletion ch15/ex15.15.16.17/bulk_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Bulk_quote : public Disc_quote
public:
Bulk_quote() = default;
Bulk_quote(const std::string& b, double p, std::size_t q, double disc) :
Disc_quote(b,p,q,disc) { }
Disc_quote(b, p, q, disc) { }

double net_price(std::size_t n) const override;
void debug() const override;
Expand Down
Loading

0 comments on commit 49bc33d

Please sign in to comment.