#include using namespace std; #include #include //Create Function int countWords(); int countCharacters(); int countWords( string txtdata ) { ifstream file( txtdata.c_str() ); int count = 0; string temp; while (file >> temp) { count = count + 1; } return count; } int countCharacters( string txtdata ) { ifstream file(txtdata.c_str()); int count = 0; char num; while (file >> num) { count = count + 1; } return count; } int main() { cout << "Found " << countWords("txtdata.txt") << " Words" << endl; cout << "Found " << countCharacters("txtdata.txt") << " Words" << endl; return 0; }