fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. class C
  5. {
  6. public:
  7. C(const std::vector<double>& a_, const std::vector<double>& b_)
  8. :a(a_),b(b_){};
  9. double operator()(size_t i, size_t j) const { return a[i]*b[j]; }
  10. private:
  11. std::vector<double> a, b;
  12. };
  13.  
  14. int main() {
  15. C c({1,2,3,4},{10,20,30,40});
  16. cout << "3*30 "<<c(2,2);
  17. // your code goes here
  18. return 0;
  19. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
3*30 90