A C-based command-line application for managing personal expenses with multi-user support, administrative capabilities, and date tracking.
To compile the program, use the following command in your terminal:
gcc main.c user.c account.c expenses.c appmenu.c login.c signup.c filehandler.c admin.c -o expense_managerAfter compilation, run the program using:
./expense_manager- Signup - Create a new user account
- Login - Access existing user account
- Admin Login - Access administrative features
- Exit - Save and exit the program
After logging in, users can:
-
Add Account
- Create a new account with initial balance
- One account per user
-
Add Expense
- Add new expenses with title and amount
- Enter expense date (DD MM YYYY format)
- System validates date input
- System checks for sufficient balance
-
List Expenses
- View all recorded expenses
- Shows expense date, title, and amount
- Expenses displayed in chronological order
-
Check Balance
- View current account balance
-
Add Balance
- Add more money to account
-
Logout
- Return to main menu
- Username:
admin - Password:
admin123
-
View All Users
- Lists all registered users in a formatted table
- Shows user count
- Displays names and email addresses with proper spacing
- Clean and organized presentation
-
View Specific User Details
- Search user by email
- Shows user's personal information in a structured table
- Displays account details and expenses with proper formatting
- Clear visual separation of different data sections
-
View All Expenses
- Lists expenses for all users in a well-formatted table
- Shows per-user totals with clear separation
- Displays grand total across all users
- Organized presentation with proper spacing
-
View Expenses by Date Range
- Enter start date (DD MM YYYY)
- Enter end date (DD MM YYYY)
- Shows expenses within specified date range in a formatted table
- Displays per-user totals for date range
- Shows summary statistics:
- Total number of expenses in range
- Total amount of expenses
- Average expense amount
- Date validation included:
- Validates date format
- Checks for valid dates (including leap years)
- Ensures start date is before or equal to end date
- Displays expenses in a clean, formatted table with:
- User name
- Expense title
- Date (DD/MM/YYYY format)
- Amount
- Shows "No expenses found" message if no expenses exist in range
-
View Total Expense Statistics
- Total number of users
- Number of users with expenses
- Total expenses across all users
- Average expense per user
- User with highest expenses
- All statistics displayed in a clean, formatted table
-
Clean All User Data
- Option to remove all user data and files
- Useful for system maintenance or testing
- Removes both user accounts and expense records
- Cleans up the entire userdata directory
- Multi-user support
- Secure login system
- Persistent data storage
- Single account per user
- Balance tracking
- Expense recording
- Balance validation
- All user data stored in a dedicated
userdatadirectory - Separate files for user accounts and expenses
- Organized file structure for better management
- Automatic directory creation if not exists
- User data saved automatically
- Expenses stored per user
- Data loaded on startup
- Auto-save on important operations
- Secure admin access
- Comprehensive user monitoring
- Expense tracking and statistics
- Detailed user information access
- Data cleanup functionality
- Formatted table displays for better readability
- Password protection
- Separate user accounts
- Protected admin access
- Data integrity checks
- Date tracking for all expenses
- Date range filtering
- Date validation
- Chronological expense listing
- Date-based expense analysis
- Support for expenses from year 2000 onwards
The program maintains data in an organized structure:
userdata/directory for all user-related filesuserdata/users.dat- Stores user account informationuserdata/expenses_[email].dat- Stores expenses for each user
- Title: Description of expense
- Amount: Cost in floating-point format
- Date: DD MM YYYY format
- Valid date ranges:
- Day: 1-31
- Month: 1-12
- Year: 2000 onwards
- Enter dates in DD MM YYYY format (e.g., 15 03 2024)
- Invalid dates will be rejected
- Date range queries show summary statistics
- Expenses are automatically sorted by date
- Use date ranges to track periodic spending
- Admin tables provide better readability with proper spacing
- All data is automatically saved after important operations
- Keep your email and password safe
- Admin credentials should be changed in production
- Regular backups of userdata directory recommended
- Use the cleanup feature carefully as it removes all user data