#include #include #include #include using namespace std; #include "utility.h" int main() { srand(time(0)); cout << fixed << setprecision(3); //show 3 decimals cout << "Testing the rand and prime functions" << endl; for (int i = 0; i < 10; i++) { int a = rand(245); int b = rand(1034, 23476); cout << setw(10) << a << " "; if (prime(a)) cout << "prime"; else cout << " "; cout << setw(10) << b << " "; if (prime(b)) cout << "prime"; else cout << " "; cout << endl; } cout << endl; cout << "Testing the distance function." << endl; cout << "The distance from (0,0) to (3,4) is " << distance (0,0,3,4) << endl; cout << "The distance from (1.1,2.2) to (-1.1, -2.2) is " << distance(1.1,2.2,-1.1,-2.2) << endl; cout << endl; cout << "Using the PI constant" << endl; cout << "The area of a circle with radius 7 is " << PI * 7 * 7 << endl; cout << endl; return 0; }