You will write a C++ program to count words and numbers in a plain text file. Words and numbers can be repeated. You can use any algorithm and data structures that you prefer, as long as results are correct. It is preferred, but not necessary, that your algorithm is as efficient as possible, both in processing time as well as memory management.
The input is one text file, with words and integers, separated by any other symbols including spaces, commas, period, parentheses and carriage returns. Keep in mind there can be be multiple separators together (e.g. many spaces, many commas together).
The input is simple. You can assume a word is a string of letters (upper and lower case) and a number a string of digits (an integer without sign). Words and numbers will be separated by at least one non-letter or one non-digit symbol.
Length: You can assume one word will be at most 30 characters long and a number will have at most 10 digits.
Repeated strings: words and numbers can be repeated. However, you are not asked count distinct words or compute frequency per word, which require algorithms and data structures to be covered in the course. Therefore, you just simply need to count word or numver occurrences.
For this homework we will not ask you to consider all potential inputs. Notice you are not asked to handle floating point numbers, which require decimal point and scientific notation. Therefore, a period can be considered a separator. Notice also we will avoid abnormal strings like variable names combining letter and digits (X1, student2, ..).
Example of input files (between the lines) and result (on the screen): input1.txt
The cat is [there] 10 20 3.1416,,1000 another cat Program output: words=6 numbers=5
Intel CPU, Western Digital Hard disk 4 cores, 16 GB RAM,, ... $ Program output: words=9 numbers=2
Notice words and numbers can appear in any order, one or more per line. Also, notice there may be extra symbols (separators) you should simply skip since they are neither words nor numbers
The main program should be called count. The GNU C++ compile and Call syntax is as follows from OS prompt: g++ -o count *.cpp count filename=input1.txt
Notice that the file name will not necessarily be the same every time. Therefore, your program will have to take that into account.
The output should be sent to the screen, as shown in the examples. Use only this format. Avoid introducing extra symbols or strings since your program will be graded automatically. For instance, avoid using phrases like the output is, or the word count is). words=4 numbers=5