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

我的为什么wa,,

Posted by drownever at 2006-12-13 09:20:30 on Problem 3157
#include<iostream.h>
#include<string.h>
int main()
{char array[200],s[200],temp=0;
int flag=0;
cin>>array;
for(int i=0;i<strlen(array);i++)
{if(array[i]=='_'){flag=1;

if(!(array[i+1]<=122&&array[i+1]>=97)){cout<<"Error!"<<endl;return 0;}}
}
if(flag==0){
for(int e=0;e<strlen(array);e++)
{if(array[e]<=90&&array[e]>64){s[temp++]='_';s[temp++]=array[e]+32;}
else s[temp++]=array[e];
}
s[temp]='\0';
cout<<s<<endl;
}

if(flag==1){
for(int v=0;v<strlen(array);v++)
{if(array[v]=='_'&&array[v+1]>=97&&array[v+1]<=122)array[v+1]=array[v+1]-32;
else s[temp++]=array[v];
}
s[temp]='\0';
cout<<s<<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