<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      類和對象

      #include "complex.hpp"
      #include <iostream>
      
      
      void test() {
          using namespace std;
      
          Complex c1(6, 6);
          const Complex c2(6);
          Complex c3(c1);
      
          cout << "c1 = ";
          c1.show();
          cout << endl;
      
          cout << "c2 = ";
          c2.show();
          cout << endl;
          cout << "c2.imag = " << c2.get_imag() << endl;
      
          cout << "c3 = ";
          c3.show();
          cout << endl;
      
          cout << "abs(c1) = ";
          cout << abs(c1) << endl;
      
          cout << boolalpha;
          cout << "c1 == c3 : " << is_equal(c1, c3) << endl;
          cout << "c1 == c2 : " << is_equal(c1, c2) << endl;
      
          Complex c4;
          c4 = add(c1, c2);
          cout << "c4 = c1 + c2 = ";
          c4.show();
          cout << endl;
      
          c1.add(c2);
          cout << "c1 += c2, " << "c1 = ";
          c1.show();
          cout << endl;
      }
      
      int main() {
          test();
      }
      

        

      #pragma once
      
      #include <iostream>
      #include <cmath>
      
      using std::cout;
      using std::endl;
      
      class Complex
      {
      public:
          Complex(double r = 0.0, double i = 0.0) : real{r}, imag{i} {}
          Complex(const Complex &obj) : real{obj.real}, imag{obj.imag} {}
      
      public:
          double get_real() const { return real; }
          double get_imag() const { return imag; }
          void show() const;
          void add(const Complex &obj);
      
          friend Complex add(const Complex &c1, const Complex &c2);
          friend bool is_equal(const Complex &c1, const Complex &c2);
          friend double abs(const Complex &obj);
      
      private:
          double real; 
          double imag; 
      };
      
      void Complex::show() const
      {
          if (imag > 0)
          {
              cout << real << " + " << imag << "i";
          }
          else if (imag < 0)
          {
              cout << real << " - " << abs(imag) << "i";
          }
          else
          {
              cout << real;
          }
      }
      
      void Complex::add(const Complex &obj)
      {
          real += obj.real;
          imag += obj.imag;
      }
      
      Complex add(const Complex &c1, const Complex &c2)
      {
          return Complex(c1.real + c2.real, c1.imag + c2.imag);
      }
      
      bool is_equal(const Complex &c1, const Complex &c2)
      {
          if (c1.real == c2.real && c1.imag == c2.imag)
              return true;
          return false;
      }
      
      double abs(const Complex &obj)
      {
          return sqrt(obj.real * obj.real + obj.imag * obj.imag);
      }
      

        

      #include "User.hpp"
      #include <iostream>
      
      
      void test()
      {
          using std::cout;
          using std::endl;
      
          cout << "testing 1......\n";
          User user1("cfl", "123456", "cfl@qq.com");
          user1.print_info();
      
          cout << endl
               << "testing 2......\n\n";
      
          User user2("xl");
          user2.change_passwd();
          user2.set_email();
          user2.print_info();
      
          cout << endl;
          User::print_n();
      }
      
      int main()
      {
          test();
      }
      

        

      #pragma once
      
      #include <iostream>
      #include <string.h>
      #include <algorithm>
      
      
      using namespace std;
      
      
      class User
      {
      public:
          User(string n, string p = "111111", string e = "");
          void set_email();
          void change_passwd();
          void print_info();
          static void print_n() { cout << "there are " << count << " users" << endl; }
      
      public:
          static int count;
      
      private:
          string name;
          string passwd;
          string email;
      };
      
      int User::count = 0;
      
      User::User(string n, string p, string e)
      {
          name = n;
          passwd = p;
          email = e;
          count++;
      }
      
      void User::set_email()
      {
          string s1;
          cout << "Enter email address: ";
          cin >> s1;
          email = s1;
          cout << "email is set successfully..." << endl;
      }
      
      void User::change_passwd()
      {
          cout << "Enter old password: ";
          int times = 0;
          while (times < 3)
          {
              string s1;
              cin >> s1;
              if (s1.compare(passwd)==0)
              {
                  cout << "Enter new passwd: ";
                  string s1;
                  cin >> s1;
                  passwd = s1;
                  cout << "new passwd is set successfully..." << endl;
                  break;
              }
              if (times < 2)
                  cout << "password input error. Please re-enter again:";
              times++;
          }
          if (times >= 3)
              cout << "passwd input error. Please try affter a while." << endl;
      }
      
      void User::print_info()
      {
          cout << "name: " << name << endl;
          cout << "passwd: ";
          string s1(passwd.length(), '*');
          cout << s1 << endl;
          cout << "email: " << email << endl;
      }
      

        

       

      posted on 2022-10-15 20:09  cflxl  閱讀(38)  評論(0)    收藏  舉報

      導航

      主站蜘蛛池模板: 亚洲国产精品一区二区第一页| 欧美伦费免费全部午夜最新| 无码任你躁久久久久久久| 精品尤物TV福利院在线网站| 国产精品一二二区视在线| 青青草一区在线观看视频| 天台县| 国产精品老熟女乱一区二区| 亚洲国产精品综合久久2007| 女高中生自慰污污网站| 色欲av亚洲一区无码少妇| 99在线精品国自产拍中文字幕| 亚洲欧美v国产一区二区| 色94色欧美sute亚洲线路二| 国产午夜亚洲精品国产成人 | 国产av一区二区三区精品| 午夜爽爽爽男女免费观看影院| 97精品尹人久久大香线蕉| 国产精品无遮挡又爽又黄| 亚洲乱码中文字幕小综合| 亚洲V天堂V手机在线| 久久久精品2019中文字幕之3| 无码天堂亚洲国产AV| 99久久国产综合精品成人影院 | 国产精品涩涩涩视频网站| 喀喇沁旗| 国产99在线 | 免费| 亚洲AV无码精品色午夜果冻| 国产无人区码一区二区| 潘金莲高清dvd碟片| 国产欧美综合在线观看第十页 | 任丘市| 一个色综合亚洲热色综合| 2019国产精品青青草原| 国产中文字幕精品喷潮| 国产av无码国产av毛片| 欧美一区二区三区欧美日韩亚洲| 日韩精品有码中文字幕| 亚洲熟女乱色综合亚洲图片| 亚洲精品天堂在线观看 | 99精品国产精品一区二区|