Final answer:
The task involves writing a C++ program using a hash map to check if an email contains true information based on word frequency, excluding certain punctuation and the greeting line. Emails with all words having a frequency of one are false. For true emails, output the word frequencies in lowercase and alphabetical order.
Step-by-step explanation:
To create a C++ program that determines the veracity of emails based on word frequency, you will need to utilize a hash map to store each word's frequency. The process for this program includes reading the email text, ignoring punctuation, and storing words in a map. If all words in the email have a frequency of one, the email is marked as 'False'; otherwise, it is marked as 'True'. Additionally, when an email is determined to be 'True', the program should output the frequency of each word in lowercase and alphabetical order.
To start, you will read the input file and split the content by blank lines to separate each email. For each email, you will preprocess the text to remove greeting lines, convert to lowercase, and strip punctuation. Afterward, you will iterate over each word, increment its count in the hash map, and then check the word counts to determine the email's status. If an email is labeled as 'True', you will output the word frequency in the specified format. If labeled as 'False', simply output 'False'. This C++ implementation makes use of the std::unordered_map from the STL to handle the hash map functionalities.