I'm trying to learn C++. I'm very new to the field of programming. 
In the C++ Without Fear, the book I'm currently following, there's an example which I followed, but whenever I run the code, there's an error. I copy-pasted the code to make sure I didn't miss anything, but the error still persists. I use Dev-C++ as a compiler. Please help me.
The bolded line of code is the highlighted one when an error occurs.
This is in the Compiler log:
In the C++ Without Fear, the book I'm currently following, there's an example which I followed, but whenever I run the code, there's an error. I copy-pasted the code to make sure I didn't miss anything, but the error still persists. I use Dev-C++ as a compiler. Please help me.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n; // Number to test for prime-ness
int i; // Loop counter
int is_prime = true; // Boolean flag...
// Assume true for now.
// Get a number from the keyboard.
cout << "Enter a number and press ENTER: ";
cin >> n;
// Test for prime by checking for divisibility
// by all whole numbers from 2 to sqrt.
i = 2;
while (i <= sqrt) { // While i is <= sqrt
,
if (n % i == 0) // If i divides n,
is_prime = false; // n is not prime.
i++; // Add 1 to i.
}
// Print results
if (is_prime)
cout << "Number is prime." << endl;
else
cout << "Number is not prime." << endl;
system("PAUSE");
return 0;
}
The bolded line of code is the highlighted one when an error occurs.
This is in the Compiler log:
Compiler: Default compiler
Executing g++.exe...
g++.exe "E:\bin\shge.cpp" -o "E:\bin\shge.exe" -fexceptions -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
E:/bin/shge.cpp: In function `int main()':
E:/bin/shge.cpp:15: call of overloaded `sqrt(int&)' is ambiguous
C:/Dev-Cpp/include/math.h:163: candidates are: double sqrt(double)
C:/Dev-Cpp/include/c++/cmath:465: long double std::sqrt(long
double)
C:/Dev-Cpp/include/c++/cmath:461: float std::sqrt(float)
Execution terminated