c++ coding

what does name.compare do actually?

if(name.compare("Michael") == 0){
//attend1
showAttend(attend1);
}

else if(name.compare("Paul") == 0){
//attend2
showAttend(attend2);
}

else if(name.compare("Linda") == 0){
//attend3
showAttend(attend3);
}

else if(name.compare("Jacklyn") == 0){
//attend4
showAttend(attend4);
}
else if(name.compare("Joel") == 0){
//attend5
showAttend(attend5)
Well, we can't see what "name" is. So one can't know for sure. Also don't forget to use code tags - http://www.cplusplus.com/articles/jEywvCM9/

It looks like it's the compare function for std::string - http://www.cplusplus.com/reference/string/string/compare/
Last edited on
One might take a guess (something one should not usually do) that the question relates to std::string::compare()

http://www.cplusplus.com/reference/string/string/compare/

See also relational operators for std::string.
http://www.cplusplus.com/reference/string/string/operators/

Topic archived. No new replies allowed.