overloaded funtion with sqrt c++(helped)
Posted: Sun Mar 25, 2012 12:25 am
the error reads as "more than one instance of overloaded funtion sqrt in argument list" is there something wrong with #include <cmath>?
thank you for you're time.
error is in sqrt()
Code: Select all
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout<<"please enter a value to be evaluated as prime or not prime";
int x=0;
cin>>x;
int loop=2;
int prime=true;
while(loop == sqrt(x));<----this is the error.
{
if (x % loop==0)
prime=false;
loop++;
}
if(prime)
cout<<"number is prime";
else
cout<<"number is not prime";
system("PAUSE");
return 0;
}
thank you for you're time.
error is in sqrt()