| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
谁能帮我看一下,怎么就错了呢?????哪儿错了????#include<iostream>
#include<string>
using namespace std;
class jin
{
public:
void black(int x,int y,int l);
void white(int x,int y,int l);
void test(int x,int y,int l);
private:
int a[100][100];
};
int main()
{
string word;
jin hao;
int b,x,y,l;
cin>>b;
for(int i=1;i<=b;i++)
{
cin>>word>>x>>y>>l;
if(word=="BLACK")
{
hao.black(x,y,l);
}
else if(word=="WHITE")
{
hao.white(x,y,l);
}
else if(word=="TEST")
{
hao.test(x,y,l);
}
}
return 0;
}
void jin::black(int x,int y,int l)
{
for(int j=1;j<=l;j++)
{
for(int k=1;k<=l;k++)
{
a[x+j-1][y+k-1]=1;
}
}
}
void jin::white(int x,int y,int l)
{
for(int j=1;j<=l;j++)
{
for(int k=1;k<=l;k++)
{
a[x+j-1][y+k-1]=0;
}
}
}
void jin::test(int x,int y,int l)
{
int m=0;
for(int j=1;j<=l;j++)
{
for(int k=1;k<=l;k++)
{
if(a[x+j-1][y+k-1]==1)
m++;
}
}
cout<<m<<endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator