ASSIGNMENT 1 2025
UNIQUE NO.
DUE DATE: APRIL 2025
, COS3711
Assignment 1 2025
Unique Number:
Due Date: April 2025
Advanced Programming
Question 1: Command-Line Text Analyzer (Regex + Flags)
Create a C++ console app count that:
Accepts flags -a, -b, -c, -d.
Accepts one or multiple filenames.
Uses regular expressions to count based on the flag logic.
Outputs count results for each flag.
🛠️ Regex Logic for Each Flag:
1. -a: Words > 4 characters starting with a capital letter
Regex: \b[A-Z][A-Za-z]{4,}\b
2. -b: Hyphenated words (hyphen not at start/end)
Regex: \b\w+-\w+\b
3. -c: Words that start and end with the same letter
Regex: \b(\w)\w*\1\b
4. -d: Words NOT starting with a vowel
Regex: \b[^aeiouAEIOU\s\W]\w*\b
📁 Suggested File Structure:
count.cpp