Between lines 51 and 52 you need to add
return EXIT_SUCCESS;. (If you start your code blocks with the name of the language you are using, you get line numbers: [code=C++].)
Line 56: are you sure there is an argv[ 1 ]?
Line 57: are you sure there is an argv[ 2 ]?
Line 62: isn't that the same as
if (argc == 2) ?
Line 90: you could just swap the numbers so that num1 < num2...
A few other notes. Choose C or C++, not both:
1. Use
#include <cstdlib>
2. When dealing with boolean values, use the keywords
true and
false, so it is obvious that you are dealing with a boolean value and not an integer.
3. Likewise, when testing boolean values, say
if (a[num1])
or
if (a[num1] == true)
4. Stick lines 43..52 as the first thing in your main. (There are good reason's why, but I don't want to take the time to explain them all now...)
5. Use functions.
6. Old C people and those who don't know better like to have their students use
const int foosize = 12000; and junk like that. That's really about the same thing as saying:
#define foosize 12000
The better way is just to declare your array as
bool a[1000000]; and use the sizeof operator to get its size later:
for (int i = 0; i < sizeof( a )/sizeof( a[ 0 ] ); i++)
Well, it is another way, at least. (It prevents you from being tempted to do dumb things.)
7. You forgot to use
strtoul()...
You seem to have a pretty good grasp of what your code should be doing. Good job.
Hope this helps.