Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

谁能帮我看一下,怎么就错了呢?????哪儿错了????

Posted by 11106113 at 2007-06-09 11:16:04 on Problem 1656
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator