acil yardım!

m tabanında verilen iki sayının çarpımı istenmektedir. Bu çarpımı tekrarlamalı
(recursive) olarak yapan programı yazamadım yardımcı olur musunuz??
Do you mean that you need to perform manipulations of symbolic representations of numbers in base m that represent multiplication? It really is just addition with a bit mode. Can you do addition?
evet ek kullanabilirz ama nasıl olacak?
Say you have the two numbers you want to add in arrays a, b and result in c. write c[i] = a[i]+b[i]; and then, if (c[i]>=m) { c[i] -= m; c[i+1]+=1; }.

Also, do you mind writing in English? I don't know what language you speak and only understand you with Google translate, so it's not great.
do you look for some thing like:
1
2
3
4
5
6
7
8
9
10
11
12
int multiply(int a, int b){
	if(b <= 1)
		return a;
	return a + multiply(a,--b);
}

int main() {

	int a(4),b(6);
	cout<<a <<" *  "<<b<<" = "<<multiply(a,b)<<endl;
	return 0;
}
Topic archived. No new replies allowed.