I am just trying to compile a simple string compare program and it will not work. I am using g++ and here is the error
strcomp.cpp: In function `int main (...)':
strcomp.cpp:10: no matching function for call to `basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >::strcmp
(char *&, const char[3])'
And here is the code:
Code:#include <iostream> #include <string> void main() { char *vari; cout << "Type up: "; cin >> vari; string stri; if(stri.strcmp(vari,"up")==0) { cout << "\nGood\n"; } else { cout << "\nBad\n"; cout << "You entered " << vari << endl; } return 0; }