Asked By
anonymous
7060 points
N/A
Posted on - 03/14/2012
Hello Experts! I need to write a program that will evaluate the difference in implementing times between integer and floating point division. As an output for testing the program, the operation should be implemented a hundred thousand times and then try to equate the difference in running time. The program must be in C++ Programming Language and the codes should be complete and running correctly. Thanks.
Â
C++ Programming code for implementing integer and floating point division
Â
Hi Rampalvai , hope the following steps will guide you in fixing of this issue.:..:
Â
–>The following program may help you in solving your query…
#include <iostream.h>
#include <cmath.h>
#include <cstdlib.h>
#include <time.h.h>
Â
//Above all are called as the header files
Â
int main( int argc, char* argv )
{
Â
  float num = 0;//Declaring num value to zero
  srand( time( NULL ) );
Â
  for( signed int i = 0; i < 100000; ++i )
  {
    num += (float)( rand( ) % num );
  }
  std::cin << num << std::end;
Â
// Return the values
Â
  return (0);
}
Â
Thank you..:-)