I am writing a program that counts the number of words in a text file.
How would I go about useing a command line argument as the text file name that will be opened? Right now i am opening a file in the same directory as the program.(test.txt file)
for example: wordcount somefile.txt
would open "somefile" and count the words in it.
using namespace std;
int main (int argc, char * argv )
int wordcount = 0;
int letters = 0;
double average = 0;
if (infile.fail( ))
cout << "Input file opening failed.\n";