how can I stop the program with writing \"done\"? This is my code, how can I sto
ID: 3566668 • Letter: H
Question
how can I stop the program with writing "done"?
This is my code, how can I stop it when i write done and view the names in reverse without the word done in it. also remove the comma from the first name?
Please use my Code
#include
#include
#include
#include
using namespace std;
int main(){
int numVals = 20;
vector userName(numVals);
for (int i = 0; i < numVals; i++){
cout << "Please enter a name: ";
getline(cin, userName.at(i));
}
for (int y = 19; y >= 0; y--){
cout << ", " << userName.at(y);
}
cout << endl;
return 0;
}
Explanation / Answer
add break(); to the end of it
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.