| ||||||||||
| 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 | |||||||||
我的为什么wa,,#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator