Your call to rand() should have a semi-colon (;) after it. That's likely the source of your syntax error. rand() returns an integer between 0 and RAND_MAX. An easy way to get a random number between 0 and some_number is to do:
Code:
int num = rand() % upper_limit;
If upper_limit is 50 it will return a number between 0 and 49 inclusive. The random number generator needs to be seeded if you want a different random number every time. srand() is used to do this. A common seed is the current time. You only want to call srand() once in your program, so somewhere before your first call to rand() you might do:
srand(time(0));