1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
// Function Prototypes
void readFilename(ifstream&, string&);
void countCharsLines(ifstream&, int&, int&, char&);
void populateArray(ifstream&, string[]);
void outputResults(string&, int&, int&, string[]);
int main()
{
// Variables
ifstream inFile;
string filename;
int countLines;
int countChars;
char ch;
string words[1000];
// Function Calls
readFilename(inFile, filename);
countCharsLines(inFile, countLines, countChars, ch);
populateArray(inFile, words);
outputResults(filename, countLines, countChars, words);
return 0;
}
// FUNCTION WITH ISSUES
void outputResults(std::string &filename, int &countLines, int &countChars, std::string* words[])
{
cout << "Filename: " << filename << endl;
cout << "Number of lines: " << countLines << endl;
cout << "Number of characters: " << countChars << endl;
cout << "Words: " << words[] << endl;
}
|