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

谁能帮忙看看错在哪里啊!好郁闷!3Q!!!

Posted by CD at 2005-05-13 19:13:23 on Problem 2039
#include < iostream >
#include < string >
using namespace std;
int main()
{
	char a[200][200], b[200][200], c[201], lenth, col, m;
	int n;
	cin>>n;
	while (n!=0)
	{
		m=n-1;
		cin>>c;
		lenth=strlen(c);
		col=lenth/n;
		for(int i=0;i<col;i++)
		{
			for(int j=0;j<n;j++)   
			{
				a[i][j]=c[i*n+j];
			}
		}
		for(i=0;i<col;i++)
		{
			for(int j=0;j<n;j++)   
			{
				if((i+1)%2 == 0)
				{
					b[i][j]=a[i][m];
					m--;
				}
				else b[i][j]=a[i][j];
			}
			m=n-1;
		}
		for(i=0;i<n;i++)
		{
			for(int j=0;j<col;j++)   
			{
				cout<<b[j][i];
			}
		}
		cout<<endl;
		cin>>n;
    }    
	return 0;
}

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