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 |
什么测试数据都过,为什么错啊?哪位大牛帮帮忙啊,感激不尽~~~#include<iostream> #include<string> #include<cctype> using namespace std; bool tranfer(string a,char b[],int &length) {int leng=a.size(); int i,j; if(isupper(a[0])||a[0]=='_'||a[leng-1]=='_')return false; int big=0; int lowline=0; for(i=0,j=0;i<leng;i++) { if(lowline==1&&big==1)return false; if(a[i]!='_'&&islower(a[i])){b[j]=a[i];j++;} if(a[i]=='_'){if(a[i+1]=='_')return false;lowline=1;b[j]=toupper(a[i+1]);j++;i++;} if(isupper(a[i])){big=1;b[j]='_';j++;b[j]=tolower(a[i]);j++;} }length=j; return true; } int main() { string a; while(cin>>a) { char b[200]; int length; if(!tranfer(a,b,length)){cout<<"Error!"<<endl;} else {for(int k=0;k<length;k++)cout<<b[k];cout<<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