fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. #include <sstream>
  5. using namespace std;
  6.  
  7. int main(){
  8.  
  9. //strcpy - String copy, strcat= string concatenantion?, strlen.
  10.  
  11. char chArray[80];
  12. char chArray2[80];
  13.  
  14. //cin >> chArray; // Doesn't handle white space.
  15. //getline(cin, varname)-- not suitable for character arrays. Be careful with these.
  16. cout << "Enter your first name: ";
  17. cin >> chArray;
  18.  
  19. cout << "\nEnter your last name: ";
  20. cin >> chArray2;
  21. //cin.getline(chArray, 79);//Last character needs to be a '\0'--Null zero.
  22. /*
  23.   int i;
  24.   for(i=0; chArray[i]!='\0'; i++){// |D|A|M|I|E|N|\0| | | | | | | | | | | | | | | |
  25.   chArray2[i]=chArray[i];
  26.   }
  27.   chArray2[i] = '\0';
  28.   */
  29. //strcpy(chArray2, chArray);
  30. strcat(chArray,chArray2);
  31. cout <<"Your name is: "<<chArray;
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. return 0;
  42. }
  43.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Damien
OfReddit
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:30: error: ‘strcat’ was not declared in this scope
stdout

Standard output is empty