#include <iostream.h>
#include <windows.h>
#include <time.h>
int x, y, z, a, b, c;
int numbers[200];
srand(time(NULL));
I'm being told:
g:\c++\2004_two\2004_two.cpp(11) : error C2501: 'srand' : missing storage-class or type specifiers
g:\c++\2004_two\2004_two.cpp(11) : error C2373: 'srand' : redefinition; different type modifiers
c:\program files\microsoft visual studio\vc98\include\stdlib.h(308) : see declaration of 'srand'
I'd guess from this horrifically ancient header that the OP is using a decade-old compiler, in which case #include <cstdlib> might have to be #include <cstdlib.h> .
Please, get a compiler that conforms to at least one of the C++ standards.
Edit: I see from other threads that you do indeed have some kind of FrankenCompiler that accepts code that isn't C++. You're doing yourself no favours by learning ... whatever it is that you're learning. :)
And indeed, why not. Why should the education system teach you modern (correct) C++ using free tools far better than VS6, when they could cripple your abilities instead? Marvellous.
programs output a value to the OS on exit. This can be useful in batch files to know whether a program completed its job successfully, which can abort the script (ie, a compiler returning a failure code will let the build script know that it shouldn't try to run the linker)
main has to return an int to give the OS that code.