Untitled

mail@pastecode.io avatar
unknown
plain_text
19 days ago
453 B
1
Indexable
Never
#include <iostream>
#include <algorithm>
using namespace std;


class SumFunctor {
public:
    int operator()(int a, int b) {
        return a + b;
    }
};

int main() {
   
    SumFunctor sum;

    
    int num1, num2,result;
    std::cout << "Enter Number 1: ";
    std::cin >> num1;
    std::cout << "Enter Number 2: ";
    std::cin >> num2;

   
    result = sum(num1, num2);

    
    std::cout << "Sum: " << result << std::endl;

    return 0;
}
Leave a Comment