Write a program that uses a multiset of strings to keep track of a list of chore
ID: 645330 • Letter: W
Question
- Write a program that uses a multiset of strings to keep track of a list of chores that you have to accomplish today. The user ofthe program can request several services: 1) add an item to the list of chores; 2) ask how many chores are in the list; 3) use the iterator to print the list of chores to the screen; 4) delete an item from the list; 5) exit the program. If you know how to read and write strings from a file, then have the program obtain its initial list of chores from a file. When the program ends, it should write all unfinished chores back to this file.
- For Programming Project 19, you have to do the part for having the program obtain its initial list of chores from a file. It is NOT optional since you should know how to work with strings and files.
- Write a program that uses a multiset of strings to keep track of a list of chores that you have to accomplish today. The user ofthe program can request several services: 1) add an item to the list of chores; 2) ask how many chores are in the list; 3) use the iterator to print the list of chores to the screen; 4) delete an item from the list; 5) exit the program. If you know how to read and write strings from a file, then have the program obtain its initial list of chores from a file. When the program ends, it should write all unfinished chores back to this file.
- For Programming Project 19, you have to do the part for having the program obtain its initial list of chores from a file. It is NOT optional since you should know how to work with strings and files.
Explanation / Answer
#include <string>
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
int main() {
ifstream input("chore.txt");
multiset<int> values; /*Read the data from the file*/
string s1
("add an item to the list of chores");
string s2
("ask how many chores are in the list");
string s3
("use the iterator to print the list of chores to the screen");
string s4
("delete an item from the list");
string s5
("exit the program");
int request severalservice;
while (input >> request severalservice);
service.insert(request severalservice); /**/
cout << "unfinished chores: " <<to write unfinished chores back to file() <<end1;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.