Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help with the codding assignment in C++ I will up vote!!!!!!!! Veite a C+ + program that reads from a file specified in the command
Help with the codding assignment in C++ I will up vote!!!!!!!!
Veite a C+ + program that reads from a file specified in the command line as an argument. The program stiould read trom the file words until the end of file n case the file is empty, print ovi on a new line the message "File is empty. and then exit. However. if no file rame is provided, the program should print o new line "NO SPECIFIED INPUT FILE NAMEN, and exit if the file cannot be opened, print on a new line 'CANNOT OPEN THE FILE: followed by the file tame, and exit. A word is defined as a sequence of one or more non whitespace characters separated by whitespace. The program should recognize words that represent integer numbers, fixed-point numbers and special names. An integer is defined as a word that starts by digit, or a sign (i.e., or +) followed by a digit, that may be followed by zero or more digits. A fixed-point number is defined as a word that starts by a dipt, or an optional sign followed by a digit, and followed by zero or more digits, a decima point (fie, a dot) and one or more digits, For example. "O.4. *2. 2 : '-3.75" are valid fixed-point numbers. but "5." ".8*. "5. 6.7 " are not valid fixed-point numbers. A special name is defined as a vord that starts by 'S' and ollowed by a letter which may be followed by zero or more letters, digits or underscores, For exarnple., 5value. 5 num_234_ ten, and are valid names, but \$9val, and \$_num are not. The program should count and display the number of recognized integers fixed point numbers and special names. Ther the program should disptay the value of each word category and the number of occurrences of that word. The pregracn should print out the results according to the format and order given y the example below, as the list of integers first, followed by the list of reals second, then che list of special names third. Hint: You can create a simple directory for each kind of words (integers, froed-point numbers, names) using the \&map container, where the key is a namber or a name, and the value is the number of its occurrences Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started