So i was just coding around and i wanted to do something, so i decided to make a story, so first of all i typed: #include <iostream> using namespace std; int main() { int Name; cout << "\nENTER YOUR NAME: "; cin >> Name; cout << "Hello " << Name << ", welcome to the story!"; return 0; } So when i run this code i put my name "Kali" and its suppose to say "Hello Kali, welcome to the story" but instead of that it says "Hello 0, welcome to the story". Can anyone help me with this problem?
Nah, im bored, im just gonna make a story, like, you read the story im typing in and questions is gonna come and you gonna answer but i need to fix that problem first
It looks like you are trying to assign a string (a name) to an integer data type, which is not allowed. Here is something I found that might help: http://www.cplusplus.com/reference/string/string/getline/
You may also need to #include<string> up at the top of the program, otherwise some less flexible compilers may yell at you because they don't know what the hell a string is by default.