I've made a program that uses iostream.h and am trying to calculate Einsteins famous equation (E=m*(c*c)) but the program has problems with such large integers. I know that I probably should use a different (or one more) header file, but witch?
I use Borland c++ compiler so I already have quite a lot of header files (no need for me to download (probably)).
Code:int relativity() { int e; int mj; float m; int speedoflightinsquare; speedoflightinsquare=90000000000000000; cout<<"\nDefine the mass in Kg: "; cin>>m; e=m*speedoflightinsquare; mj=e/1000000; cout<<"The energy in the object is approximately: "<<mj; return 0; } //mj=MegaJoule



LinkBack URL
About LinkBacks


