hi every one;
i saw this question and im trying to solve it.\
baseically i have to matrix's which each element is afraction
so i must declare a class that has in the privet to float members numerator and denomnator
and in the public i have constructer function to inilize the arrays
and function subtract ,multiply,and add,.
and im asked to add the 2 matrix and subtract them...

sample input:
3/2 4/5 1/4
4/9 7/9 2/4
and the other matrix has the same format...
note that each function has parameter (2 fractions)

i just need som idea how to solve this problem??
i now the basic but when it comes to functions i feel confused and
i dont know how to complet..

thanks in advance.:)

Sounds like you need to make a "Fraction" class and then make an array (I'd recommend a std::vector) of Fraction objects.

std::vector<Fraction> fractions;

I hope this gets you started - once you get some code written post it here and I'm sure someone can help you with any difficulties.

Dave

unfortionatly i didnt take vectors yet at collge im still abiggener
im planing to studey them on summer:)
thats why i feel confused ...
is there any other ideas that it can push me forward..

moonl!ght

hi there,
since that time i was tring and i figured that there was a mistak done by the writer of the question so this is apart of the code

int siz1,siz2;

fraction::fraction()
{
	//decleartion and opining files
	fstream indata;
	indata.open("matrixes.txt");
	if(indata.fail())
	{
		cout <<"cannot open the file \n";
		exit(1);
	}
	cout<<"hi"<<endl;
	indata>>siz1>>siz2;
	cout<<"hi"<<endl;
	for(int x=0;x>siz1;x++)
	{

		for(int y=0;y>siz2;y++)
		{
			indata>>MTRX1[x][y].num>>MTRX1[x][y].div>>MTRX1[x][y].denum;
			cout<< MTRX1[x][y].num<<MTRX1[x][y].div<< MTRX1[x][y].denum<<"    ";}
	cout <<endl;
	}

and the problem is that the compiler dosent go thruogh the loop !!
dose any one now why?

replace x>sizl with x<sizl

thanks very much ...sometimes you cannot recognise the mistacke by your self you need a thired eye..:) thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.