i'm newbie in c++, and i wrote code which prompt user to input something ( in string), and i want to evaluate the input. like this
i try to compile the program , but the compiler result an error.Code:#include "iostream.h" void main() { char name[25]; cout << "Enter Your Name "; cin >> name; if (name == 'ILO') { cout << "Handsome"; } else { cout << "Ugly"; } }
the message is :
"C:\BelajarCE++\LatihString\LatihString.cpp(13) : error C2446: '==' : no conversion from 'const int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\BelajarCE++\LatihString\LatihString.cpp(13) : error C2040: '==' : 'char [25]' differs in levels of indirection from 'const int'
Error executing cl.exe."
Please help me how to handle this. thank's in advice .![]()
![]()
![]()
![]()




Reply With Quote