expected primary-expression before ')' token

March 9, 2011 at 05:18:10
Specs: Windows XP
expected primary-expression before ')' token
expected ';' before numeric constant
on lines 14,17,21,24,28
I can't seem to see what is the problem with my code. I tried making [] to () and {} but it poses more problems. I also noticed that the error only comes up at those with random on it.
I had srand(time(NULL)); on it but it gets an error so I deleted it. And for randomize(); the compiler thinks of it as a function. I really don't know whats the problem.

[code]
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
int n,h;
int main() {

int bingocol[5];
int bingorow[20];
int x,z;
for (x=0;x<=4;x++)
{
bingocol[x] = rand%()15+1; ----> Line 14
if(bingocol[x] == bingocol[x-1])
{
bingocol[x] = rand%()15+1; ----->Line 17
}
for (z=0+n;z<=3+n;x++)
{
bingorow[z] = rand%()30+1+h; -----> Line 21
if(bingorow[z] == bingorow[x-1])
{
bingorow[z] = rand%()30+h+1; ------> Line 24

if(bingorow[z] < 30+h)
{
bingorow[x] = rand%()30+h+1; ------>Line 28
}
}
}
n=n+4;
h=h+15;
}
printf("%d%d%d%d%d",bingocol[0],bingocol[1],bingocol[2],bingocol[3],bingocol[4]);

getch();
}
[/code]


See More: expected primary-expression before ) token

Report •

#1
March 9, 2011 at 07:18:06
In each of those lines your % operator is misplaced. They should be:

bingocol[x] = rand() % 15+1;

etc.


Report •
Related Solutions


Ask Question