On Thu, Mar 6, 2008 at 10:52 AM, Robert Ryan <[EMAIL PROTECTED]> wrote:
>    what does it mean: error undeclared
>  thanks
>
>    #include <iostream>
>   using namespace std;
>   int main()
>   {
>          cout << "Please enter an integer in the range 1 to 10 
> (inclusive):\n";
>           int n = 0;
>           while (n==0) {
>                   cin >> n;
>                   if (cin) { // we got an integer; now check it:
>                   if (1<=n && n<=10) break;
>                   cout << "Sorry, " << n
>                           << " is not in the [1:10] range; please try 
> again\n";
>           }
>   }
>
>           if (cin.fail()) { // we found something that wasn.t an integer
>           cin.clear(); // we.d like to look at the characters
>           cout << "Sorry, that was not a number; please try again\n";
>           char ch;
>           while (cin>>ch && !isdigit(ch)) { // throw away non-digits
>                   // we didn.t find a digit: give up
>                   if (!cin) error("no input");
>                   // put the digit back, so that we can read the number
>                   cin.unget();
>           }
>   }
>
>
>   .cpp: In function `int main()':
>   .cpp:22: `error' undeclared (first use this function)
>   .cpp:22: (Each undeclared identifier is reported only once for each
>      function it appears in.)

You don't have error() declared anywhere, but you use it on line 22.
Are you missing a header?

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to