C++ help run again
Go to solution
Solved by Nineshadow,
12 minutes ago, derrickd241 said:and here's the whole program if that helps
No because when I run this sure the run again displays but it displays one client in the array and it needs to loop main again so it will print them all at the same time then ask run again? then it will print them all at once again, so no this is the same problem I was having before
I didn't really understand tbh, but is this what you're looking for?
int main() { bool moreInput = false; do { string input = ""; priority_queue<Client, vector<Client>, CompareClients> pq; Client clientArray[5] = { { "John", "Doe", "719 444-5555" }, { "Mary", "Doe", "719 444-5556" }, { "Hari", "Keri", "719 555-4444" }, { "Mari", "Mee", "719 555-4445" }, { "John", "Doe", "719 444-5557" } }; for(Client i : clientArray) pq.push(i); while (!pq.empty()) { Client c2 = pq.top(); cout << "The Client being Popped = " << setw(10) << left << c2.fName << " " << setw(10) << left << c2.lName << " " << setw(14) << left << c2.areaCode << " " << setw(14) << left << c2.prefix << " " << setw(14) << left << c2.suffix << " " << endl; pq.pop(); } moreInput = runAgain(); } while (moreInput); }

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now