| ||||||||||
| 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 | |||||||||
请教各位大侠
知道是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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator