## moonL!ght

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

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

## daviddoria 334

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

## moonL!ght

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

## 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?

## daviddoria 334

replace `x>sizl` with `x<sizl`

## moonL!ght

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