The exercise from my book reads:
'Define a class named Name_value that holds a string and a value (int)and a vector named Name_value. Give it a constructor. Store name and value "pairs" in each vector element instead of using two separate vectors... as were
used in ex 4_19.' The following is the debris left from my many previous attempts. I would appreciate some specific direction on how to proceed as I'm stumped. I have Googled extensively without joy. There is no urgency.
'Define a class named Name_value that holds a string and a value (int)and a vector named Name_value. Give it a constructor. Store name and value "pairs" in each vector element instead of using two separate vectors... as were
used in ex 4_19.' The following is the debris left from my many previous attempts. I would appreciate some specific direction on how to proceed as I'm stumped. I have Googled extensively without joy. There is no urgency.
Code:
#include<iostream> #include<vector> using namespace std; class Name_value { public: string name; int value; Name_value (vector<Name_value>v); }; int main() { Name_value v; system("pause"); return 0; }
Comment