I dont understand why I'm getting this error here.

#include <cstdlib>
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main(int argc, char *argv[])
{
    string value;
    int number;
    
    
    
    cout << "Enter an integer: ";
    getline( cin, value );
    if( !isvalidInt( value ) )
        cout << "The number you entered is not a valid integer."   << endl;
    else
    {
        number = atoi( value.c_str() );
        cout << "The number you entered is " << number << endl;
        cout << "Its square root is " << sqrt( number ) << endl;
    }

    system("PAUSE");
    return EXIT_SUCCESS;
}

I'm getting this error:
`isvalidInt' undeclared (first use this function)

I can't declare it cause then I ca't use it as a function.
The purpose for the exercise is to modify the program to continually request an integer until a valid number is entered.
Where did that isvalidInt come from?

>>Where did that isvalidInt come from?

You wrote the program, we didn't. You will probably have to write that function yourself because it is not standard C or C++ function.

I did not write the program it came out of the book. Another smart person did it. I'm just supposed to modify it.
Ancient Dragon thats what I was asking what is that I have never seen that before. How do I write that function?

The function might be located somewhere else in the book. If not, what do you think that function is supposed to do? It looks like it's looking at a string and asking if the user input a valid integer.

Yeah Rashakil Fol. I did some more searching and I found what I was looking for. Thanks for your help guys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.