#include #include #include using namespace std; int main(){ int p, x, y, dv, di, r, i; double w; vector x1; vector x1r; vector y1; vector y1r; vector suma; vector sumar; cout<<"Introduce the base: "<>p; cout<<"Introduce the first integer: "<>x; cout<<"Introduce the second integer: "<>y; dv=x; di=p; while (dv>=p){ r=dv-((dv/p)*p); dv=dv/p; x1.push_back(r); } x1.push_back(dv); dv=y; di=p; while (dv>=p){ r=dv-((dv/p)*p); dv=dv/p; y1.push_back(r); } y1.push_back(dv); while(x1.size()>y1.size()){ y1.push_back(0); } while(y1.size()>x1.size()){ x1.push_back(0); } i=x1.size()-1; while(i>=0){ x1r.push_back(x1[i]); //cout<=0){ y1r.push_back(y1[i]); //cout<=0){ w=(x1r[i]+y1r[i]+emp)%p; suma.push_back(w); emp=(x1r[i]+y1r[i]+emp)/p; i--; } if(emp!=0){ suma.push_back(emp); } i=suma.size()-1; cout<<"result: "; while(i>=0){ sumar.push_back(suma[i]); cout<