If you turn warnings up higher you'll see that strcmp() is undefined because you didn't include <stdlib.h>, and likewise for printf() because <stdio.h> is missing. (Just postulating here.)
If you just want to compare the first character of a string with another character, simply use ==:
Code:
if(astring[0] == achar) {}
If you want to search for a single character inside a string, you can use strchr().
In case you're interested, there are many functions that deal with strings and characters. Here's a list. http://cppreference.com/stdstring/index.html
[edit] Compiling the above code with dinkumware.com/exam:
MINGW/C++:
Code:
sourceFile.cpp: In
function `int main()':
sourceFile.cpp:6: `printf'
undeclared (first use this function)
sourceFile.cpp:6: (Each
undeclared identifier is reported only once for each function it appears
in.)
sourceFile.cpp:7: `scanf'
undeclared (first use this function)
sourceFile.cpp:9: `strcmp'
undeclared (first use this function)
sourceFile.cpp:13:2: warning: no newline at end of file
VC++ v8/C++:
Code:
sourceFile.cpp
sourceFile.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
sourceFile.cpp(6) : error C3861: 'printf': identifier not found
sourceFile.cpp(7) : error C3861: 'scanf': identifier not found
sourceFile.cpp(9) : error C3861: 'strcmp': identifier not found
sourceFile.cpp(10) : error C3861: 'printf': identifier not found
[/edit]