No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
[code] #include<iostream> #include<conio.h> #include<string> using namespace std; int main() { int i,len,t; cin>>t; char a[100],b[100]; while(t>0) { cin>>a; len=strlen(a);len=len-1; for(i=0;i<=len;i++) { b[i]=a[len-i]; } cout<<"value of a\n"<<a<<"\n"<<b; if(strcmp(a,b)==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; t--; } getch(); return 0; } [/code] every time the loop runs the garbage value of char b; remains. . … |
|
Re:
My program should find any 4 letter words and change them into string "love" ... i have successfully found all the spaces and modified any 4 letter words before the spaces... however, the last word before the '/0' doesn't change... please help. btw, is there any string class function check … |