using namespace std;int underscore(char c[]);void clang(char v[]);void java(char c[]);int main(){ char c[101]; int x=0,y=0; gets(c); x=underscore(c); for(int i=0;i<strlen(c);i++) { if(c[i]>=65&&c[i]<91) y++; } if(x>=0&&y==0) java(c); else if(x==0&&y>=0) clang(c); else cout<<"error!"; return 0;}int underscore(char c[]){ int i=0,j=0; while(c[i]!='\0'){ if(c[i]=='_') j++; i++; } return j;}void java(char c[]){ int k=0; for(int i=0;i<strlen(c);i++) { if(c[i]=='_') { k++; continue; } else if(k==1) { cout<<char(c[i]-32);k=0; } else cout<<c[i]; }}void clang(char v[]){ int k=0; for(int i=0;i<strlen(v);i++) { if(v[i]>=65&&v[i]<91) { cout<<'_'<<char(v[i]+32); } else cout<<v[i]; }}
Your code is broken. Please correct your markdown, use e.g. triple back-ticksbefore and after your code, or [code] ... [/code].
back-ticks
[code] ... [/code]
Please provide a link to the problem you are dealing with – or at least the problem code.