Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (smilie2015):

need help here is the solution of c++ string manipulation

OpenStudy (smilie2015):

#include <iostream.h> #include <string.h> using namespace std; void uppercaseString(char *s){ while( (*s = toupper(*s)) ) ++s; } main() { char *a=new char[40]; char *b=new char[40]; char *c=new char[40]; char *d=new char[40]; char e[80]; char s[80] = "a,b"; cout <<"Enter string 1 : "; cin >> a; cout <<"Enter string 2 : "; cin >> b; //length of strings cout<< "The length of string 1 is : " <<strlen(a) << endl; cout<< "The length of string 2 is : " <<strlen(b) << endl; //upper case uppercaseString(a); cout << "String 1 in upper case: " << a << endl; uppercaseString(b); cout << "String 2 in upper case: " << b << endl; if(strcmp(a,b)==0) { cout<<"Both strings are the same \n"; } else { cout<<"Both strings are different \n"; } //concatenation of strings strcat(e,a); strcat(e,b); cout<< "Both strings after concatenation: " << e << endl; }

OpenStudy (smilie2015):

plz look in the screen shot that after concatenation : \[L \pm Openstudy\] why it is \[L \pm \] ?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!