
Andy C. answered 10/14/18
Math/Physics Tutor
using namespace std;
#include <iostream>
#include <stdlib.h>
int main()
{
long lNumIter=0;
while (true)
{
int x = rand() % 10;
int y = rand();
int z = rand();
double decNum = (y<=z)? ((double)(y*1.0f)/z) : ((double)(z*1.0f)/y) ;
std::cout << "decimal is: " << x+decNum << endl;
lNumIter++;
if ((y==0) || (z==0)) { break; }
}
std::cout << " # of iterations " << lNumIter << endl;
return 0;
}