leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0537.cpp (315B)
0 class Solution { 1 public: 2 string complexNumberMultiply(const string num1, const string num2) { 3 int a, b, c, d; 4 char t; 5 stringstream(num1) >> a >> t >> b; 6 stringstream(num2) >> c >> t >> d; 7 return to_string(a * c - b * d) + "+" + to_string(a * d + b * c) + "i"; 8 } 9 };