[ create a new paste ] login | about

Link: http://codepad.org/igdzwNnE    [ raw code | output | fork ]

C++, pasted on Mar 20:
#include <iostream>
using namespace std;

int Array[] = {1,2,3,4,5,6,7,8,9};
int Array2[] = {11,12,13,14,15,16,17,18,19};

int najmniejszy_dzielnik(int m){
	cout<<"Array["<<m<<"] = "<<Array[m]<<endl;
	return Array[m];
}

int* czynniki_pierwsze(int m){
	int temp,i, helper;
	for(temp=m, i=1; i < temp; i++){
		helper=najmniejszy_dzielnik(temp);
		cout<<"test1, array[5] = "<<Array[5]<<endl;

		Array2[i]=helper; //------------------------------problem here
		cout<<"test2, array[5] = "<<Array[5]<<endl;

		temp/=helper;
		cout<<"test3, array[5] = "<<Array[5]<<endl;

	}
	Array2[0]=i;
	return Array2;
}

int main ()
{
	czynniki_pierwsze(8);
	return 0;
}


Output:
1
2
3
4
Array[8] = 9
test1, array[5] = 6
test2, array[5] = 6
test3, array[5] = 6


Create a new paste based on this one


Comments: