need help writing RemoveName and Findname in my program
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include<iostream>
#include<vector>
#include<cstdlib>
#include<string>
using namespace std;
void getLists(vector<string>&);
void sortNames(vector<string>&);
void displayLists(vector<string>);
void removeList(vector<string>);
// This while allows entry until ‘quit’ is entered
int main(){
vector<string> name;
getLists(name);
displayLists(name);
removeList(name);
string tmp;
system("pause");
return EXIT_SUCCESS;
}
void getLists(vector<string>& names){
while (true) {
string tmp;
cout << "Enter a name (quit to stop): ";
cin >> tmp;
if (tmp == "quit") break;
names.push_back(tmp);
}
}
void displayLists(vector<string>names)
for(int i = 0; i < names.size(); i++) {
cout << names[i] << endl;
}
void removeItem(vector<string>names);
{
while (true) {
string N;
cout << "Enter a name you want to delete";
cin >> N;
if (N == "Remove Name") break;
names.push_back(N);
}
}
| |
Last edited on