Im writing a program that creates matrices and what not then count different things based on the elements in the matrix. That all works fine except 1 part, dividing 2 specific numbers. What htis is for isint important because everything works fine EXCEPT that one part. Anyway, im supposed to calculate Km = t2/m, t2 = 15, r = 21. Km is double, t2 and r are both int. At first i though the problem was that t2 and r were both int,but even when i just write "Km = 16/21" it gives me Km = 0. The thing is i calculate a lot of other divisions but this is the only one thats giving me a problem.
here is the part of the code even though i doubt it'll be a of much use. Knk and Krk all work fine its just that Km thats giving me problems
Knk = t5/r;
Km = t2/m;
Krk = 2*t6/(t3*(t3 - 1));
cout<<"t5 = "<<t5<<endl;
cout<<"t6 = "<<t6<<endl;
cout<<"Km = "<<Km<<endl;