Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // BMV.cpp : Defines the entry point for the console application.
- // Used on VS 2017
- #include "stdafx.h"
- #include <iostream>
- #include <vector>
- #include <fstream>
- #include <string>
- using namespace std;
- //TO_DO: Need to make an if for start a new list (basically delete everything in the old list)
- int main()
- {
- ofstream fout; //of and if stream function thingies
- ifstream fin;
- cout << "Welcome to Matthew's Barmitzvah list. Would you like to edit? (y/n)" << endl; // First Entry point. Basic Opening. Make a view list option available
- string start;
- cin >> start;
- string answer;
- while (start == "y") { //while loop for first entry point
- cout << "To add a new person, type(add), to delete a person, type(delete), and to view the list, type(view)" << endl; //Second Entry point. Asks what they want to do
- cin >> answer;
- vector<string> people(1);
- if (answer == "add") { //the add a person(s) option
- cout << "Keep typing in people, type (done) when finished" << endl << endl;
- string newPerson;
- cin >> newPerson;
- fout.open("People.txt", ios_base::app);
- while (newPerson != "done") {
- fout << newPerson << endl;
- cin >> newPerson;
- }
- fout.close();
- }
- if (answer == "delete") { // the delete a person(s) option. Have it so it views list before they put it an input of person(s) to delete. Also have option for deleting of whole list. Or possibly even say like people 1-5 (<-- example)
- }
- if (answer == "view") { // the view list option. To view the list
- fin.open("People.txt");
- string person;
- while (!fin.eof()) {
- fin >> person;
- if (fin.good()) {
- cout << person << endl;
- }
- }
- fin.close();
- }
- cout << endl << "What would you like to do next? (add, delete, view) If nothing, type (exit) to exit." << endl; // Third Entry Point. Repetitive. Last entry point allowing for repeated options
- cin >> answer;
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement