#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstdlib>
using namespace std;
void getFileName(ifstream& input, ofstream& output) //gets filename
{
string fileName;
cout << "Enter the file name: ";
cin >> fileName;
input.open(fileName.c_str());
if( !input )
{
cout << "Incorrect File Path" << endl;
exit (0);
}
output.open("c:\\users\\jacob\\desktop\\thomannProj3Results.txt");
}
void countWords(ifstream& input) //counts words
{
bool notTrue = false;
string words;
int i = 0;
while( notTrue == false )
{
if( input >> words )
{
i++;
}
else if( !(input >> words) )
notTrue = true;
}
cout << "There are " << i << " words in the file." << endl;
}
void countChars(ifstream& input, char storeCharacters[], ofstream& output) // counts characters
{
int i = 0;
while( input.good() && !input.eof() )
{
input.get(storeCharacters[i]);
i++;
}
output << storeCharacters[0];
}
void sortChars() //sorts characters
{
}
void printCount() //prints characters
{
}
int main()
{
ifstream input;
ofstream output;
char storeCharacters[1000] = {0};
getFileName(input, output);
countWords(input);
countChars(input, storeCharacters, output);
return 0;
}