Firstly, look at the following simple code.
int main(){
char *name;
cout << "Enter your name: ";
cin >> name;
cout << "Your name is: " << name;
return 0;
}
The previous code gives me the following error warning: deprecated conversion from string constant to 'char*'
.
but I have been solved the problem by:
const char *name;
After compile the code, I have another error no match for 'operator>>' (operand types are 'std::istream {aka std::basic_istream<char>}' and 'const char*')
.
What the reason of the previous error, and how to solve it ?