I need to make a C++ calculator that can +, -, *, /, % and ^. I cannot use +, -, *, /, and % in my code at all.
#include<iostream>
using namespace std;
typedef long long ll;
ll add(ll a,ll b){
if(b==0)return a;
else return add(a^b,(a&b)<<1);
}
ll sub(ll a,ll b){
if(b==0)return a;
else return sub(a^b,((~a)&b)<<1);
}
Here is what I have. I don't know how to code the multiplication and division parts. Any help?