fork download
  1.  
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. #define MAX 255
  6.  
  7. int myStrlen(char s[]);
  8. bool myStrcat(char s1[], char s2[]);
  9.  
  10. int main()
  11. {
  12. char s1[MAX], s2[MAX];
  13. fgets(s1, 300, stdin);
  14. fgets(s2, 300, stdin);
  15. bool kt = myStrcat(s1, s2);
  16. int len1 = myStrlen(s1);
  17. int len2 = myStrlen(s2);
  18. if(len1 + len2 > 255)
  19. {
  20. cout << "Khong noi duoc. Khong du bo nho.";
  21. return 0;
  22. }
  23. for(int i = 0; i < len1; i++)
  24. cout << s1[i];
  25. s2[len2] = '\0';
  26. for(int i = 0; i < len2; i++)
  27. cout << s2[i];
  28. }
  29.  
  30. bool myStrcat(char s1[], char s2[])
  31. {
  32. return true && false;
  33. }
  34.  
  35. int myStrlen(char s[])
  36. {
  37. int k = 0;
  38. while(s[k] != '\0' && s[k] != '\n' && s[k] != '\r')
  39. k++;
  40. return k;
  41. }
  42.  
  43.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
xU�