Urgent help for super beginner

Write your question here.
Hello everyone, I am new in programming. This is one of my exercise and I don't know why I can't put more than one character inside variable (name) and BMI also cannot be calculated. Sry for the bad language...
#include <iostream>
using namespace std;
int main()
{
int BMI, weight, height;
char name;
cout << "Please enter your name: " << endl;
cin >> name;
cout << "Plaese enter your weight: " << endl;
cin >> weight;
cout << "Please enter your height" << endl;
cin >> height;
cout << "_____________________________________________" << endl;
BMI= weight/(height*height);
cout << "Name :" << name << "\nWeight" << "\tHeight" << "\tBMI" << endl;
cout << weight << "\t" << height << "\t" << BMI << endl;


system("pause");
return 0;
}
char name;
What's this? It's a char, yes? One char. A single char. Just one char. How did you expect to store more than one character in it?

Use a string
What Moschops says.
"char" represents a character - 8 bits of memory. The computer will read only one character. If you type "John", it will read "J" into name and "o" into weight".
ok, thanks everyone
Topic archived. No new replies allowed.