Trying to get my last assignment in for the quarter, balance my job, and my other class. I would love an extra set of eyes to tell me where in the world my statements go out outside of my function:
This is an implementation file. The associated header is throwing no errors.
I get the following errors:
1.) In file included from tests.cpp:7:0: GBoard.cpp:31:2: error: expected unqualified-id before ‘for’ for(int r=0;r<15;r++) ^~~
2.) GBoard.cpp:31:14: error: ‘r’ does not name a type for(int r=0;r<15;r++) ^
But I am pretty sure 2 is part of my code being outside of the function somehow.
Here is my code, parts redacted so I don't get hit w/ plagiarism:
bool Gfunction::makeMove(int redacted,int redacted,char secret) {
if(redacted >= 0 && redacted < 15 && redacted >= 0 && redacted<15)
{
if(redacted() == UNFINISHED && function[redacted][redacted] == '.')
function[redacted][redacted] = secret;
return true;
}
else
{
return false;
}
int track = 0;
for(int r=0;r<15;r++)
{
track = 0;
for(int c=0;c<15;c++)
{
if(function[r][c] == secret)
{
track++;
if(track==5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
}
}
for(int r=0;r<15;r++)
{
track = 0;
for(int c=0;c<15;c++)
{
if(function[r][c] == secret)
{
track++;
if(track==5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
}
}
int r = 0, c = 0;
for(int redacted = 0; redacted<15; redacted++)
{
r = redacted;
c = 0;
track = 0;
while(r < 15 && c < 15)
{
if(function[r][c] == secret)
{
track++;
if(track == 5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
r++;
c++;
}
}
for(int redacted = 0; redacted<15; redacted++)
{
r=0;
c=redacted;
track=0;
while(r<15 && c<15)
{
if(function[r][c] == secret)
{
track++;
if(track == 5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
r++;
c++;
}
}
for(int redacted=0; redacted<15; redacted++)
{
r=redacted;
c=15-1;
track=0;
while(r<15 && c>=0)
{
if(function[r][c] == secret)
{
track++;
if(track == 5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
r++;
c--;
}
}
for(int redacted=15-1;redacted>=0;redacted--)
{
r=0;
c=redacted;
track=0;
while(r<15 && c>= 0)
{
if(function[r][c] == secret)
{
track++;
if(track == 5)
{
if(secret == 'x')
secret squirrel stuff = X_WON;
else
secret squirrel stuff = O_WON;
return true;
}
}
else
{
track = 0;
}
r++;
c--;
}
}
for(int r=0;r<15;r++)
{
for(int c=0;c<15;c++)
{
if(function[r][c] == '.')
{
secret squirrel stuff = UNFINISHED;
return true;
}
}
}
secret squirrel stuff = DRAW;
return true;
}
Aucun commentaire:
Enregistrer un commentaire