fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. //char s1[100], s2[100], i, j;
  6. string s1("hello");
  7. string s2="world";
  8. s1=s1+s2;
  9. //printf("Enter first string: ");
  10. //scanf("%s", s1);
  11.  
  12. // printf("Enter second string: ");
  13. //scanf("%s", s2);
  14.  
  15. // calculate the length of string s1
  16. // and store it in i
  17. /* for(i = 0; s1[i] != '\0'; ++i);
  18.  
  19.   for(j = 0; s2[j] != '\0'; ++j, ++i)
  20.   {
  21.   s1[i] = s2[j];
  22.   }
  23.  
  24.   s1[i] = '\0';*/
  25. //s1=s1+s2;
  26. cout<<s1<<"\n";
  27. printf("After concatenation: %s", s1);
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
helloworld
After concatenation: