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.


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..


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;

	//decleartion and opining files
	fstream indata;
		cout <<"cannot open the file \n";
	for(int x=0;x>siz1;x++)

		for(int y=0;y>siz2;y++)
			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?

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

This question has already been answered. Start a new discussion instead.