<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 概念 用戶自己定義的類型的數據,是不能直接用“>”來輸出和輸入的? 如果想用它們輸出和輸入自己聲明的類型的數據,必須對它們重載? # 形式 ~~~ istream & operator >> (istream &,自定義類 &); ? ? //流插入 ostream & operator << (ostream &,自定義類 &); ? ? //流提取 ~~~ # 例子 ~~~ // 重載流插入運算符“<<” ? #include <iostream> using namespace std; ? class Complex { ? ?public: ? Complex() ? { ? ? ? real=0;imag=0; ? } ? Complex(double r,double i) ? { ? ? real=r;imag=i; ? } ? Complex operator + (Complex &c2); ? friend ostream& operator << (ostream&,Complex&); ? ?private: ? double real; ? double imag; }; Complex Complex::operator + (Complex &c2) { ? ?return Complex(real+c2.real,imag+c2.imag); } ? ostream& operator << (ostream& output,Complex& c) { ? ?output<<"("<<c.real<<"+"<<c.imag<<"i) " ? ? ? ?<<endl; ? ?return output; } ? int ?main() { ? ?Complex c1(2,4),c2(6,10),c3; ? ?c3=c1+c2; ? ?cout<<c3; ? ?return 0; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看