The errors:Code:#include <iostream> #include <fstream> using namespace std; int prime [10000]; int index = 0, min, max; bool isPrime(int x); void genPal(int num, int add, int mulleft, int mulright); int main(){ ifstream fin ("pprime.in"); ofstream fout ("pprime.out"); fin >> min >> max; int max2 = max; int length; for(length = 0; max2; length++){ max2 /= 10; } cout << length << '\n'; } bool isPrime(int x){ if(x < min || x > max || x%2 == 0 || x%3 == 0) return false; for(int i = 2; i*i < x; i++) if(x%i == 0) return 0; return true; } void genPal(int num, int add, int mulleft, int mulright){ int i, nmulleft, nmulright; if(num == 2) for(i = 0; i < 10; i++) add+mulleft * i + mulright * i << '\n'; else if(num == 1) for(i = 0; i < 10; i++) cout << add + mulright * i << '\n'; else{ nmulleft = mulleft / 10; nmulright = mulright * 10; num -= 2; for(i = 0; i < 10; i++) genPal(num, add+i*mulleft + i*mulright, nmulleft, nmulright); } }
test.cpp: In function 'int main()':
test.cpp:15: error 'min' undeclared(first use in this function)
and others like this. How do I fix this without making the variable min local to the main method?