Why the input is incomplete?

My output comes incomplete when I build the program. When I input a name it comes incomplete. Exemple below.Why does that happen ?

Ex:

What's your name:
Alan
Hello A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 #include <iostream>
#include <string>


#define LOG(x) std::cout<< x << std::endl;

	void Print(char name) {
		std::cout <<"Hello "<< name << std::endl;
}
	


int main()
{
	char name;
	std::cout<< ("What's your name? ");
	std::cin >> name;
	Print(name);
	
	std::cin.get();
}
Last edited on
On line 9: The type name is a single character, hence you get only a single character.

If you want a a string use std::string or similar.
Thank you very much, it worked ;)
Topic archived. No new replies allowed.