Question: / / * * * * * * * * * * * * * * * * * * * * * * *
File: NameReport.cpp
Student: Benjamin Russell
Assignment: Program #
Course Name: Programming II
Course Number: COSC
Due: November
Description:
Other files required:
names.txt
#include
#include
#include
using namespace std;
void handleMenuifstream& fin;
void displayFirstFiveifstream& fin;
void displayLastFiveifstream& fin;
int countifstream& fin;
void addNewNames;
enum MENU
FIRSTFIVE,
LASTFIVE,
COUNT,
ADDNEW,
QUIT
;
int main
ifstream filenamestxt;
if filefail
cout "Cannot open names.txt endl;
cout
Display first five names
Display last five names
Count the number of names
Add a new name
Quit
;
handleMenufile;
file.close;
return ;
void handleMenuifstream& fin
int choice;
choice ;
while choice QUIT
cout "Enter a choice: ;
cin choice;
if choice FIRSTFIVE
displayFirstFivefin;
else if choice LASTFIVE
displayLastFivefin;
else if choice COUNT
cout "There are countfin names";
else if choice ADDNEW
addNewNames;
else if choice QUIT
cout "QUIT";
else
cout "Invalid Choice";
void displayFirstFiveifstream& fin
fin.clear;
fin.seekgL ios::beg;
char name;
int lineCount ;
while lineCount && fin.getlinename
cout lineCount name endl;
lineCount;
void displayLastFiveifstream& fin
fin.clear;
fin.seekgL ios::beg;
char name;
int totalCount countfin
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
