精华内容
下载资源
问答
  • Quote

    2017-03-19 11:08:29
    Quote.h #ifndef QUOTE_H #define QUOTE_H #include #include class Quote { friend bool operator !=(const Quote& lhs, const Quote& rhs); public: Quote() { std::cout << "default constructing Q



    Quote.h

    #ifndef QUOTE_H
    #define QUOTE_H
    
    
    #include <string>
    #include <iostream>
    
    
    class Quote
    {
        friend bool operator !=(const Quote& lhs, const Quote& rhs);
    public:
        Quote() { std::cout << "default constructing Quote\n"; }
        Quote(const std::string &b, double p) :
            bookNo(b), price(p) { std::cout << "Quote : constructor taking 2 parameters\n"; }
    
    
        //! copy constructor
        Quote(const Quote& q) : bookNo(q.bookNo), price(q.price)
        { std::cout << "Quote: copy constructing\n"; }
    
    
        //! move constructor
        Quote(Quote&& q) noexcept : bookNo(std::move(q.bookNo)), price(std::move(q.price))
        { std::cout << "Quote: move constructing\n"; }
    
    
        //! copy =
        Quote& operator =(const Quote& rhs)
        {
            if(*this != rhs)
            {
                bookNo = rhs.bookNo;
                price  = rhs.price;
            }
            std::cout << "Quote: copy =() \n";
    
    
            return *this;
        }
    
    
        //! move =
        Quote& operator =(Quote&& rhs)  noexcept
        {
            if(*this != rhs)
            {
                bookNo = std::move(rhs.bookNo);
                price  = std::move(rhs.price);
            }
            std::cout << "Quote: move =!!!!!!!!! \n";
    
    
            return *this;
        }
    
    
        //! clone self
        virtual Quote* clone() const & {return new Quote(*this);}
        virtual Quote* clone() &&      {return new Quote(std::move(*this));}
    
    
        std::string     isbn() const { return bookNo; }
        virtual double  net_price(std::size_t n) const { return n * price; }
        virtual void    debug() const;
    
    
        virtual ~Quote()
        {
            std::cout << "destructing Quote\n";
        }
    
    
    private:
        std::string bookNo;
    
    
    protected:
        double  price = 10.0;
    };
    
    
    bool inline
    operator !=(const Quote& lhs, const Quote& rhs)
    {
        return lhs.bookNo != rhs.bookNo
               &&
               lhs.price  != rhs.price;
    }
    
    
    //! non-member
    double print_total(std::ostream &os,const Quote &item, size_t n);
    
    
    #endif // QUOTE_H
    
    Quote.cpp

    #include "quote.h"
    
    
    void Quote::debug() const
    {
        std::cout //<< "data members of this class:\n"
                  << "bookNo= " <<this->bookNo << " "
                  << "price= " <<this->price<< " \n";
    }
    
    
    //! non-member
    double print_total(std::ostream &os,const Quote &item, size_t n)
    {
        // depending on the type of the object bound to the item parameter
        // calls either Quote::net_price or Bulk_quote::net_price
        double ret = item.net_price(n);
        os << "ISBN: " << item.isbn() // calls Quote::isbn
           << " # sold: " << n << " total due: " << ret << std::endl;
         return ret;
    }
    

    Disc_uote.h

    #ifndef DISC_QUOTE_H
    #define DISC_QUOTE_H
    
    #include "quote.h"
    class Disc_quote : public Quote
    {
        friend bool operator !=(const Disc_quote& lhs, const Disc_quote& rhs);
    public:
        Disc_quote() { std::cout << "default constructing Disc_quote\n"; }
    
        Disc_quote(const std::string& b, double p, std::size_t q, double d) :
            Quote(b, p), quantity(q), discount(d)
        {
            std::cout << "Disc_quote : constructor taking 4 parameters.\n";
        }
    
        //! copy constructor
        Disc_quote(const Disc_quote& dq) :
            Quote(dq), quantity(dq.quantity), discount(dq.discount)
        {
            std::cout << "Disc_quote : copy constructor.\n";
        }
    
        //! move constructor
        Disc_quote(Disc_quote&& dq) noexcept :
            Quote(std::move(dq)), quantity(std::move(dq.quantity)), discount(std::move(dq.discount))
        {
            std::cout << "Disc_quote : move constructor.\n";
        }
    
        //! copy =()
        Disc_quote& operator =(const Disc_quote& rhs)
        {
            Quote::operator =(rhs);
            this->quantity = rhs.quantity;
            this->discount = rhs.discount;
    
            std::cout << "Disc_quote : copy =()\n";
    
            return *this;
        }
    
        //! move =()
        Disc_quote& operator =(Disc_quote&& rhs) noexcept
        {
            if (*this != rhs)
            {
                Quote::operator =(std::move(rhs));
                this->quantity = std::move(rhs.quantity);
                this->discount = std::move(rhs.discount);
            }
            std::cout << "Disc_quote : move =()\n";
    
            return *this;
        }
    
        virtual double net_price(std::size_t n) const override = 0;
    
        ~Disc_quote()
        {
            std::cout << "destructing Dis_quote\n";
        }
    
    protected:
        std::size_t quantity = 3;
        double      discount = 0.0;
    };
    
    bool inline
    operator !=(const Disc_quote& lhs, const Disc_quote& rhs)
    {
        return Quote(lhs) != Quote(rhs)
                &&
                lhs.quantity != rhs.quantity
                &&
                lhs.discount != rhs.discount;
    }
    
    #endif // DISC_QUOTE_H
    

    Bulk_quote.h

    #ifndef BULK_QUOTE_H
    #define BULK_QUOTE_H
    #include "disc_quote.h"
    
    
    class Bulk_quote : public Disc_quote
    {
    
    
    public:
        Bulk_quote() {std::cout << "default constructing Bulk_quote\n"; }
    
    
        //! changed the below to the inherited constructor for ex15.27.
        //! rules:  1. only inherit from the direct base class.
        //!         2. default,copy and move constructors can not inherit.
        //!         3. any data members of its own are default initialized.
        //!         4. the rest details are in the section section 15.7.4.
        /*
        Bulk_quote(const std::string& b, double p, std::size_t q, double disc) :
            Disc_quote(b,p,q,disc) { std::cout << "Bulk_quote : constructor taking 4 parameters\n"; }
        */
        using Disc_quote::Disc_quote;
    
    
        //! copy constructor
        Bulk_quote(const Bulk_quote& bq) : Disc_quote(bq)
        { std::cout << "Bulk_quote : copy constructor\n"; }
    
    
        //! move constructor
        Bulk_quote(Bulk_quote&& bq) : Disc_quote(std::move(bq))
        {
            std::cout << "Bulk_quote : move constructor\n";
        }
    
    
        //! copy =()
        Bulk_quote& operator =(const Bulk_quote& rhs)
        {
            Disc_quote::operator =(rhs);
            std::cout << "Bulk_quote : copy =()\n";
    
    
            return *this;
        }
    
    
    
    
        //! move =()
        Bulk_quote& operator =(Bulk_quote&& rhs)
        {
            Disc_quote::operator =(std::move(rhs));
            std::cout << "Bulk_quote : move =()\n";
    
    
            return *this;
        }
    
    
        //! clone self
        virtual Bulk_quote* clone() const & {return new Bulk_quote(*this);}
        virtual Bulk_quote* clone() &&      {return new Bulk_quote(std::move(*this));}
    
    
        double net_price(std::size_t n) const override;
        void  debug() const override;
    
    
        ~Bulk_quote() override
        {
            std::cout << "destructing Bulk_quote\n";
        }
    };
    
    
    #endif // BULK_QUOTE_H
    
    Bulk_quote.cpp

    #include "bulk_quote.h"
    
    
    double Bulk_quote::net_price(std::size_t n) const
    {
        return n * price * ( n >= quantity ? 1 - discount : 1);
    }
    
    
    void Bulk_quote::debug() const
    {
        std::cout //<< "data members of this class:\n"
                  << "min_qty= " << quantity << " "
                  << "discount= " << this->discount<< " \n";
    }
    


    Limit_quote.h

    #ifndef LIMIT_QUOTE_H
    #define LIMIT_QUOTE_H
    
    #include "disc_quote.h"
    
    class Limit_quote : public Disc_quote
    {
    public:
        Limit_quote() = default;
        Limit_quote(const std::string& b, double p, std::size_t max, double disc):
            Disc_quote(b,p,max,disc)  {   }
    
        double net_price(std::size_t n) const override
        { return n * price * (n < quantity ? 1 - discount : 1 ); }
    
        void debug() const override;
    };
    
    #endif // LIMIT_QUOTE_H
    
    Limit_quote.cpp

    #include "limit_quote.h"
    
    
    void Limit_quote::debug() const
    {
        std::cout //<< "data members of this class:\n"
                  << "max_qty= " << this->quantity << " "
                  << "discount= " << this->discount<< " \n";
    }
    








    展开全文
  • quote

    2019-09-16 08:31:31
    The only constant is change.

    The only constant is change.

    展开全文
  • Quote posts missing quote

    2020-12-08 20:45:01
    <div><p>This patch fixes a couple of problems with quote post type handling. - Fetched quote posts were missing :source_url, :source_title and :text. I've added those. - Posting a quote didn't...
  • Quote

    2004-10-16 13:31:00
    1. Write it on your heart that every day is the best of the year. 铭记在心:每一天都是一年中最好的日子。 2.There is an important trick in this time-using formula: you must get into your work quickly....
    1. Write it on your heart that every day is the best of the year. 
    

    铭记在心:每一天都是一年中最好的日子。

      
    2.There is an important trick in this time-using formula: you must get into your work quickly.
    利用时间的准则有个重要的诀窍:你必须迅速投入工作
    3.People who cannot find time for recreation are obliged sooner or later to find time for illness.
    腾不出时间娱乐的人,早晚会被迫腾出时间生病。
    4.Happiness is not something you experience; it's something you remember.
    幸福不是你经历的事,而是你记得的事
    5.If you wish to succeed, you should use persistence as your good friend, experience as your reference, prudence as your brother and hope as your sentry.
    如果你希望成功,当以恒心为良友,以经验为参谋,以谨慎为兄弟,以希望为哨兵
    6.Health is certainly more valuable than money, because it is by health that money is procured.
    健康当然比金钱更为重要,因为我们所赖以获得金钱的就是健康。
    7.If you would know the value of money, go and try to borrow some.
    要想知道钱的价值,就想办法去借钱试试
    8.That man is the richest whose pleasure are the cheapest.
    能处处寻求快乐的人才是最富有的人
    9.Few things are impossible in themselves; and it is often for want of will ,rather than of means, that man fails to succeed.
    事情很少又根本做不成的;其所以做不成,与其说是条件不够,不如说是由于决心不够
    10.A man can fail many times, but he isn't a failure until he begins to blame somebody else.
    一个人可以失败多次,但是只要他没有开始责怪旁人,他还不是一个失败者
    11.The only limit to our realization of tomorrow will be our doubts of today.
    实现明天理想的唯一障碍是今天的疑虑




    展开全文
  • Quote command

    2020-12-09 09:45:19
    ve been overloading <code>/learn</code> to act as a quote, but wouldn't it be nice to have a dedicated quote command? <p>Since we'll never do our own bash.org clone (or in preparation for it!)...
  • <div><p>Currently, the get_quote function returns the symbol of the stock instead of the quote, and is implemented like so: <pre><code> def get_quote(self, stock=''): """...
  • When quote escape is defaulted to backslash, the result csv format is always double quote. <pre><code> CsvParserSettings settings = new CsvParserSettings(); settings.getFormat().setQuoteEscape(&#...
  • 15 Quote and Bulk_quote

    2019-10-20 21:48:04
    Quote class Quote.h #pragma once #include <iostream> #include <string> class Quote { public: Quote() = default; Quote(const std::string &bookNo, double book_price); std::s...

    Quote class
    Quote.h

    #pragma once
    #include <iostream>
    #include <string>
    
    class Quote {
    public:
        Quote() = default;
        Quote(const std::string &bookNo, double book_price);
        std::string isbn() const;
        double print_total(std::ostream &out, Quote &item, size_t n) const;
        virtual double net_price(size_t n) const;
        virtual void debug() const;
        virtual ~Quote();
    private:
        std::string bookNo;
    protected:
        double price;
    };
    

    Quote.cpp

    #include "Quote.h"
    
    Quote::Quote(const std::string &bookNo, double book_price)
        : bookNo(bookNo), price(book_price) {}
    
    std::string Quote::isbn() const {
        return bookNo;
    }
    
    double Quote::print_total(std::ostream &out, Quote &item, size_t n) const {
        double ret = item.net_price(n);
        out << "The book " << item.isbn() <<  " sold: " << n <<
        " total price " << ret << std::endl;
        return ret;
    }
    
    double Quote::net_price(size_t n) const {
        return n * price;
    }
    
    void Quote::debug() const {
        std::cout << "===This is a Quote call debug" << std::endl;
        std::cout << "The book number is: " << bookNo << " and the price is: " << price << std::endl;
    }
    
    Quote::~Quote() {}
    

    Bulk_quote class
    Bulk_quote.h

    #pragma once
    #include "Quote.h"
    
    class Bulk_quote : public Quote {
    public:
        Bulk_quote() = default;
        Bulk_quote(const std::string &bookNo, double book_price, size_t min_qty, double discount);
        virtual double net_price(size_t n) const;
        virtual void debug() const;
        virtual ~Bulk_quote();
    private:
        size_t min_qty;
        double discount;
    };
    

    Bulk_quote.cpp

    #include "Bulk_quote.h"
    
    Bulk_quote::Bulk_quote(const std::string &bookNo, double book_price, size_t min_qty, double discount)
        : Quote(bookNo, book_price), min_qty(min_qty), discount(discount) {}
    
    double Bulk_quote::net_price(size_t n) const {
        if (n >= min_qty) {
            return n * (1 - discount) * price;
        } else {
            return n * price;
        }
    }
    
    void Bulk_quote::debug() const {
        std::cout << "===This is a Bulk_quote object call" << std::endl;
        Quote::debug();
        std::cout << "The min number of books is: " 
                  << min_qty << " and the discount is: " 
                  << discount << std::endl;
    }
    
    Bulk_quote::~Bulk_quote() {}
    

    Limit_quote class
    Limit_quote.h

    #pragma once
    #include "Bulk_quote.h"
    
    class Limited_quote : public Bulk_quote {
    public:
        Limited_quote() = default;
        Limited_quote(const std::string &bookNo, double book_price, size_t min_qty, double discount, size_t max_qty);
        virtual double net_price(size_t n) const;
        virtual void debug() const;
        ~Limited_quote();
    private:
        size_t max_qty;
    };
    

    Limit_quote.cpp

    #include "Limited_quote.h"
    
    Limited_quote::Limited_quote(const std::string &bookNo, double book_price, size_t min_qty, double discount, size_t max_qty)
        : Bulk_quote(bookNo, book_price, min_qty, discount), max_qty(max_qty) {}
    
    double Limited_quote::net_price(size_t n) const {
        if (min_qty < n && n < max_qty) {
            return n * (1 - discount) * price;
        } else {
            return n * price;
        }
    }
    
    void Limited_quote::debug() const {
        std::cout << "===This is a Limited_quote object call" << std::endl;
        Bulk_quote::debug();
        std::cout << "The max number of books is: " << max_qty << std::endl;
    }
    
    Limited_quote::~Limited_quote() {}
    

    main.cpp

    #include <iostream>
    #include <string>
    #include "Quote.h"
    #include "Bulk_quote.h"
    
    using namespace std;
    
    int main() {
        Quote *b = new Limited_quote("tree", 25, 3, 0.3, 10);
        b->print_total(cout, *b, 8);
        b->debug();
        delete b;
    }
    
    展开全文
  • <div><p>Although single-quote literals are pending <a href="https://github.com/ponylang/pony-tutorial/issues/102">documentation, stated in <a href="https://github.com/ponylang/ponyc/issues/758">...
  • Finance-Quote-LJSE扩展了Finance :: Quote以从卢布尔雅那证券交易所获取报价。 Ljubljanska borza dd条款和条件可能涵盖此模块获得的信息。 有关详情,请参见其网页。 由作者实现的功能按每日提供的报价运行。 作者...
  • <div><p>Change double quote to single quote in scss replacement to avoid linting errors in css</p><p>该提问来源于开源项目:taptapship/wiredep</p></div>
  • <div><p>Replace double-quote with single-quote for terminal commands. Although the strings in the examples work fine, users who with randomly generated passwords may have character strings that cause ...
  • quote用法

    千次阅读 2018-12-10 18:25:50
    from urllib.request import quote a=‘测试’ url = quote(a, encoding=“utf-8”) print(url)
  • mysql quote_PDO::quote

    2021-01-20 20:16:37
    PDO::quotePDO::quote — 为SQL语句中的字符串添加引号。(PHP 5 >= 5.1.0, PECL pdo >= 0.2.1)说明语法public string PDO::quote ( string $string [, int $parameter_type = PDO::PARAM_STR ] )PDO::quote() ...
  • quote_machine-源码

    2021-04-07 12:58:08
    quote_machine
  • Quote-Generator-源码

    2021-03-22 05:11:46
    Quote-Generator
  • Random-quote-源码

    2021-03-17 08:09:47
    Random-quote
  • quote-generator-源码

    2021-03-14 13:46:59
    quote-generator
  • Quote-API-源码

    2021-03-13 21:07:19
    Quote-API
  • quote_app-源码

    2021-03-09 00:24:46
    quote_app
  • But I found that the follow two lines would not be joined into the same quote, when passed to my custom renderer: <pre><code> > first quote line second line underneath </code></pre> <p>I assumed ...
  • Quote expansion warnings

    2020-12-26 13:39:40
    quote expansion>:654:39: 654:48 warning: \U00ABCD12 and \uABCD escapes are deprecated <quote expansion>:654 '\U000e0100' ...'\U000e01ef' => true, ^~~~~~~~~ <quote ...
  • scrapy-quote-源码

    2021-03-09 13:30:43
    scrapy startproject quote cd quote 创建蜘蛛quote / spiders / quote_spider.py import scrapy class QuoteSpider(scrapy.Spider): name = "quote" def start_requests(self): url = getattr(self, 'url', ...
  • Escaping single quote

    2020-12-01 21:17:39
    </code> which is not the correct escape for single quote, the correct escape for single quote should be 2 single quote next to each other and the correct end result is <code>'jo''hn'...
  • Incorrect quote display

    2020-12-08 21:55:02
    m using RocketChat and a quote inside a ticket description is displayed as <code>&#39;</code> instead of quote.</p><p>该提问来源于开源项目:AlphaNodes/redmine_messenger</p></div>
  • <div><p>Fixes #21983 : The suggested fix is to escape single quote with double single quote while using MessageFormat.</p><p>该提问来源于开源项目:javaee/glassfish</p></div>
  • PDO::quote讲解

    2020-12-20 00:53:47
    PDO::quote PDO::quote — 为SQL语句中的字符串添加引号。(PHP 5 >= 5.1.0, PECL pdo >= 0.2.1) 说明 语法 public string PDO::quote ( string $string [, int $parameter_type = PDO::PARAM_STR ] ) PDO::quote()...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 25,776
精华内容 10,310
关键字:

quote