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 lh0823 at 2006-07-31 01:40:13 on Problem 2271
知道是PE,知道哪错,可就是改不出来,真是笨啊

请示下

#include<iostream>
#include<string>
using namespace std;

int main()
{
	char str[1000]={'\0'},s[1000][50]={'\0'},a[5]="<br>",b[5]="<hr>";
	int i,j=0,k,t[1000];
	memset(t,0,1000);
	while(cin.getline(str,1000))
	{
		for(i=0;str[i]!='\0';i++)
		{for(k=0;str[i]!=' '&&str[i]!='\0';i++,k++)
		    s[j][k]=str[i];
		if(k){t[j]=strlen(s[j]);j++;}}
		memset(str,NULL,1000);
	}
	int sum=t[0]+1;
	for(i=0;s[i][0]!=NULL;i++)
	{
		if(!strcmp(s[i],a))cout<<endl;
		else if(!strcmp(s[i],b))
		{cout<<"--------------------------------------------------------------------------------";sum=80;}
        else 
		{if(sum<=80)
		{cout<<s[i]<<' ';sum+=t[i+1]+1;
		if(!strcmp(s[i+1],b))cout<<endl;}
		else cout<<endl;}
		if(sum>80)sum=t[i+1]+1;
	}
	cout<<endl<<endl;
	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