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.)
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[Non-text portions of this message have been removed]