-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
30 lines (30 loc) · 1.59 KB
/
Copy pathmain.h
File metadata and controls
30 lines (30 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/******************************************************************************
# Author: Kate Stingle
# Assignment: Assignment 1 (CS 162)
# Date: April 13th, 2025
# Description: This is a menu-driven program that maintains a list of local
# farms near Portland. The app will load all farm information
# from a data file (farms.txt). If it encounters any problem
# opening or loading the data from the file, that program will
# print the error and terminate. All the data will be loaded
# to an object of type FarmList. The app allows the user to view, add,
# remove, and search for farms until the user enters q to quit.
# Once the user quits, the app will save the data back to the
# same data file when the program exits
# Sources: Assignment 1 Specifications
#******************************************************************************/
#include <iostream>
#include <fstream>
#include "farmlist.h"
// constants
char const WELCOME[] = "Welcome!\nThis program will help you manage the local farms.";
char const MENU[] = "Pick an option from below:\n\n(a)Add a new farm\n(b)List farms by name with indices\n(c)Search farms by location\n(d)Remove a farm by index\n(e)Search farms by produce name\n(q)Quit";
//function headers
int main();
void welcome();
bool openInFile(ifstream& inFile);
void readFromFile(ifstream& inFile, FarmList &farmList);
char getMenuChoice();
void execCommand(char option, FarmList &farmList);
bool openOutFile(ofstream& outFile);
void readToFile(FarmList const farmList, ofstream& outFile);