> Problem with concatenating strings.?

Problem with concatenating strings.?

Posted at: 2014-12-18 
I don't know what compiler you're working on, or for that matter, which language C or C++, but here's how I'd do it in C++ on something modern (NOT Borland C++ or Turbo C). This was done on Code::Blocks which is a fairly well supported free IDE / Compiler that works well for me.

#include

#include

using namespace std;

int main()

{

string str1, str2, str3;//How about using a real string object?

cout << "enter your first name" << endl;

cin >> str1;

cout << "enter your last name" << endl;

cin >> str2;

str3 = (str1 + " " + str2 + "\n");//Adds a space between and the newline we stripped.

cout << endl; // Screen space is free, use some;-)

cout << str3 << endl;

return 0;

}

I hope this will help you out. Good luck!

here's the code:

#include

#include

#include

#include

int main()

{

char str1,str2, str3;

cout<<"enter your first name"<
cin>>str1;

cout<<"enter your last name"<
cin>>str2;

str3=str1+str2;

cout<
getch();

return 0;

}

when i'm running this code, after giving the input, its showin a symbl like half # as output. where m i misataking?