int age, weight, height;
string catname[20];
double bmi;
char name[20];
void main()
{
cout<<"\n\nWelcome to Body Mass Index Calculator"<<endl;
cout<<"Please fill up your identity information below."<<endl;
cout<<"Name :";
cin.getline(name,20);
cout<<"Age :";
cin>>age;
cout<<"Height(cm) :";
cin>>height;
cout<<"Weight(kg) :";
cin>>weight;
formula();
result();
--------------------Configuration: Text2 - Win32 Debug--------------------
Compiling...
Text1.cpp
C:\Users\User\Desktop\Text1.cpp(44) : error C2440: 'initializing' : cannot convert from 'char [12]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Users\User\Desktop\Text1.cpp(46) : error C2440: 'initializing' : cannot convert from 'char [6]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Users\User\Desktop\Text1.cpp(48) : error C2440: 'initializing' : cannot convert from 'char [11]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Users\User\Desktop\Text1.cpp(50) : error C2440: 'initializing' : cannot convert from 'char [6]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
the left object has type char that is it can contain a single character. The right expression is a const pointer to string literal "Underweight" that is has type const char *. You may not initialize an object of type char by an expression of type const char *
So you should decide what is catname and how it should be declared. For example it could be declared either as const char *, or char [] or even as std::string