Advertisement
Guest User

Untitled

a guest
May 27th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. void strconcatenate(string s1[],string s2[],string s3[],int size) {
  6. int reached = 0;
  7. for (int i = 0; i < size; i++) {
  8. s3[i] = s1[i];
  9. reached++;
  10. }
  11. s3[reached] = "**";
  12. reached++;
  13. for (int i = 0; i < size; i++) {
  14. s3[reached] = s2[i];
  15. reached++;
  16. }
  17. }
  18.  
  19. void main() {
  20. string s1[20];
  21. string s2[20];
  22. string s3[41];
  23. for (int i = 0; i < 20; i++) {
  24. cout << "Please Input first string array index " << i << endl;
  25. cin >> s1[i];
  26. }
  27. for (int i = 0; i < 20; i++) {
  28. cout << "Please Input second string array index " << i << endl;
  29. cin >> s2[i];
  30. }
  31. strconcatenate(s1, s2, s3,20);
  32. for (int i = 0; i < 40; i++) {
  33.  
  34. cout << s3[i] << endl;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement