Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int base=0, numten, inv[100],num1[100], num2[100],somma[100],i=0,len,lenTot,conversione=0;
- bool riporto=0;
- do{
- i=lenTot;
- while(i>=0){
- somma[i] = (somma[i]+num1[i]+riporto<base) ? (num1[i]+somma[i]+riporto) : (num1[i]+somma[i]+riporto)%base;
- riporto = num1[i]+somma[i]+riporto>=base;
- i--;
- }
- somma[i-1]=riporto;
- i = riporto ? -1 : 0;
- cout<<"la somma dei numeri e'"<<endl;
- while(i<lenTot){
- cout<<somma[i];
- conversione+=num1[i]*pow(base,len-i-1);
- i++;
- }}while(num1[-1]>0)
- cout<<"programma finito"<<endl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement