Hey guys, so for my college class we have a project where we prompt the user to enter a sentence, then we take the first word (a contiguous sequence of letters delimited either by non-letter characters or by the start or the end of the string), and we evaluate it later. The professor gave us a program to test it out, but I keep getting the 3 of the error "C2660: 'getFirstWord': function does not take 1 arguments" for each of the given tests.
Ok, that makes sense, but when I declare it as
string getFirstWord(string);
I don't get the C2660 errors, but I get two new ones: LNK2019: unresolved external symbol_main referenced in function __tmainCRTStartup and LNK1120: 1 unresolved externals
In C++, it is mandatory to have a main() function that returns an int. When the program executes, the control begins from the 1st line of this main() function. You can do so by changing
Another thing I'd like to add, you do not have a return statement in your main() despite the fact that it should return an int.
For the main() function specially, the compiler understands that if no return value is given, then it by default gives it a return value of 0 upon exit.