I was having issues with another program. It was something like this:
if(n < 15000)
{
printf("I am < 15000");
return 0;
}
else if(n > 19000)
{
printf("I am > 19000");
return 0;
}
else if(n > 51000)
{
printf("I am > 51000");
return 0;
}
If n was above 51000 then it would still return "I am > 19000". I figured I needed to "close the gap" by using else if(n > 19000 && n < 51000)
so to test this I wrote this program:
#include <iostream>
int main()
{
printf("Please enter a #: ");
int block;
cin >> n;
if(n <= 10 )
{
printf("I am <= 10");
return 0;
}
else if(n <= 15000)
{
printf("I am <= 15000");
return 0;
}
else if(n > 15000 && n <= 19000)
{
printf("I am > 15000 and <= 19000");
return 0;
}
else if(n > 19000)
{
printf("I am > 19000");
return 0;
}
else if(n > 51000)
{
printf("I am > 51000");
return 0;
}
}
Trying to compile this gave me this error: "error: βcinβ was not declared in this scope"
I am using g++ <filename>
to compile on mac osx 10.7