|56|error: no matching function for call to 'isalpha(std::string&)'|
I understand that these character testing functions return ints, but I don't understand why I can't use them like how I want to use them. If the character is a letter then it should return true, and the if statement should execute the true statement returning the word variable.
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
void input();
void pigLatin(std::string);
std::string wordValidate(std::string);
int main()
{
input();
return 0;
}
//This function will take the input from the text file
//then send the input to the piglatin function.
void input ()
{
std::string word;
std::ifstream readFile;
std::ofstream writeFile;
readFile.open("ASSNG8-A.txt");
writeFile.open("ASSNG8A-CONTENTS.txt");
while (readFile >> word)
{
pigLatin(word);
}
}
//This function will remove the first letter from a word and place it
//towards the end of the word. Then it will add the string "ay" to it.
void pigLatin(std::string pigWord)
{
wordValidate(pigWord);
}
//This function verifies that the text is a letter.
//If the text is a letter, it returns the word.
//If the text is anything other than a letter,
//the function returns and error and keeps going.
std::string wordValidate(std::string palabra)
{
std::string word;
if (std::isalpha(word))
return word;
elseif (isdigit(word))
return"ERROR";
elseif (isalnum(word))
return"ERROR";
}