T
triplejump24
i LOVE doing c++ programming, but i never can get myself started! Once i
figure it out, its fun but anyways here it goes...
Im given a file c:\temp\hwk8input.txt, which contains the records of the
video collection of a small local library.
There are four fields for each video:
1) A unique video ID number without space (v1, v2, etc.);
2) The full video title;
3) The availability of the video (0 for checked out and 1 for checked
in);
4) A unique borrower ID without space (c0001, c0009, etc.) if the video is
checked out, otherwise blank.
Write code to read these data into your program, the display the following
menu to the user:
What do you want to do?
1. List all the videos
2. Check out a video
3. Exit the system
If you choose option one, videos displayed like this
Video ID: v1
Title: Godfather, The (1972)
Status: Checked out by c0001
......
And return to the menu.
If the user chooses option 2, ask for the video ID first
1) If the video ID is not valid, tell the user so and return to the menu.
2) If the video is checked in, ask for the borrower ID, then update the
status to be checked out and the borrower ID with the user input. Return
to the menu after processing.
3) If the video is already checked out, tell the user so and return to the
menu.
When the user chooses option 3, save the data back to the original input
file in the same format and terminate the program.
Your program should repeat the above until the user chooses to exit.
the following starting coade was already given to me
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int readData(string id[], string title[], string available[], string
who[]);
void saveData(const string id[], const string title[], const string
available[], const string who[], int count);
void displayAll(const string id[], const string title[], const string
available[], const string who[], int count);
int search(const string arr[], string what, int count);
void checkout(const string id[], const string title[], string available[],
string who[], int count);
int showMenu();
int main() {
string vID[50], vTitle[50], checkedIn[50], bID[50];
//read data from the input files and get the number of videos returned
int nbrVideos = readData(vID, vTitle, checkedIn, bID);
int choice;
do{
choice = showMenu();
if(choice == 1)
displayAll(vID, vTitle, checkedIn, bID, nbrVideos);
else if(choice == 2)
checkout(vID, vTitle, checkedIn, bID, nbrVideos);
}while(choice != 3);
saveData(vID, vTitle, checkedIn, bID, nbrVideos);
return 0;
sorry this is so long, but hopefully anyone can help, id appreciate it.
Thanks in advance!
figure it out, its fun but anyways here it goes...
Im given a file c:\temp\hwk8input.txt, which contains the records of the
video collection of a small local library.
There are four fields for each video:
1) A unique video ID number without space (v1, v2, etc.);
2) The full video title;
3) The availability of the video (0 for checked out and 1 for checked
in);
4) A unique borrower ID without space (c0001, c0009, etc.) if the video is
checked out, otherwise blank.
Write code to read these data into your program, the display the following
menu to the user:
What do you want to do?
1. List all the videos
2. Check out a video
3. Exit the system
If you choose option one, videos displayed like this
Video ID: v1
Title: Godfather, The (1972)
Status: Checked out by c0001
......
And return to the menu.
If the user chooses option 2, ask for the video ID first
1) If the video ID is not valid, tell the user so and return to the menu.
2) If the video is checked in, ask for the borrower ID, then update the
status to be checked out and the borrower ID with the user input. Return
to the menu after processing.
3) If the video is already checked out, tell the user so and return to the
menu.
When the user chooses option 3, save the data back to the original input
file in the same format and terminate the program.
Your program should repeat the above until the user chooses to exit.
the following starting coade was already given to me
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int readData(string id[], string title[], string available[], string
who[]);
void saveData(const string id[], const string title[], const string
available[], const string who[], int count);
void displayAll(const string id[], const string title[], const string
available[], const string who[], int count);
int search(const string arr[], string what, int count);
void checkout(const string id[], const string title[], string available[],
string who[], int count);
int showMenu();
int main() {
string vID[50], vTitle[50], checkedIn[50], bID[50];
//read data from the input files and get the number of videos returned
int nbrVideos = readData(vID, vTitle, checkedIn, bID);
int choice;
do{
choice = showMenu();
if(choice == 1)
displayAll(vID, vTitle, checkedIn, bID, nbrVideos);
else if(choice == 2)
checkout(vID, vTitle, checkedIn, bID, nbrVideos);
}while(choice != 3);
saveData(vID, vTitle, checkedIn, bID, nbrVideos);
return 0;
sorry this is so long, but hopefully anyone can help, id appreciate it.
Thanks in advance!