Oct 21, 2009 at 6:26pm
#include <conio.h>
:(
Don't bother making main take arguments if you aren't going to use them.
Ew, strcpy and memory allocation...just use an std::vector, then just .find() and .substr() to get the individual words...
if(Pig_Latin == ""){
You can replace that with:
if(Pig_Latin.empty())
For your "KillCaps" you could use:
std::transform(str.begin(), str.end(), &tolower);
For your "Killpunct" you could use:
1 2 3 4 5 6 7 8 9 10
|
class add_char {
std::string operator ()(std::string str, char chr) {
if(isalpha(curChar) || isspace(curChar)) {
str += chr;
}
return str;
}
}
new_str = std::accumulate(str.begin(), str.end(), string(""), add_char);
|
^I think this works, haven't tested it though
Last edited on Oct 21, 2009 at 7:06pm