Advanced C++ test === 你覺得你對 C++ 的認識有多少? 要來挑戰看看嗎? 以下題目皆為 ==Close book==,誠實面對自己,在 facebook 留言區,寫下你的答案吧!  ## 第一題  ## 第二題  ## 第三題  ## 第四題 :::danger 請回答 **Why**? :::  ## 第五題 :::danger 請回答 **Why**? :::  ## 第六題 這題請給出你的數學證明:  ## 第七題  ## 第八題 <!-- 這題不方便截圖,因此重製題目 --> 請修改 class `Complex` 讓 main function 可以正常編譯,並符合預期。 ```cpp= #include <cmath> class Complex { public: Complex(const double re = 0, const double im = 0) : real{re}, imag{im} {} ~Complex() = default; Complex (const Complex &) = default; Complex (Complex &&) = default; Complex &operator=(const Complex &) = default; Complex &operator=(Complex &&) = default; friend Complex Polar(const double leng, const double arg){ return Complex(leng * ::cos(arg), leng * ::sin(arg)); } friend Complex operator*(const Complex &x, const Complex &y) { return Complex(x.real * y.real - x.imag * y.imag, x.real * y.imag + x.imag * y.real); } friend Complex operator*=(Complex &x, const Complex &y) { return (x = x * y); } private: double real; double imag; }; int main(void){ Complex a(77, 66.3); a *= Polar(5.1, 5.1); return 0; } ``` ## 第九題  ## 第十題 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up