c++ - Party Invitation -
the problem working on right here, of course not looking complete answer homework problem. asking steps in final parts of question. have far:
int main() { cout << "please enter number of guests attending party: "; int k; cin >> k; cout << "please enter number of rounds of removal you'd perform: "; int m; cin >> m; (int = 1; <= m; i++) { cout << "please enter multiple @ you'd removal @ round " << << ": "; int r; cin >> r; if (k % r == 0) { k - r; } cout << k << endl; } system("pause"); }
this confusing me, , have no idea turn answers. seems i'd need array solve this, arrays in c++ cannot variable, , array length k, variable input. appreciated.
i've read question. need dynamic list linked list because need put , remove different items different index using arrays difficult.
try use std::vector or std::list, can add or remove any of list
#include <list> std::list<int> mylist;
how can add , remove values list, check link http://en.cppreference.com/w/cpp/container/list
for using own linklist, check link how create list in c++?
Comments
Post a Comment