Hello! I'm fairly new to computer science, and I'm working on a program that holds a database in a vector. The data type for the vector though is defined as a class.
My header file has this in it:
class problem {
private:
string name; //Name of person with the problem
string cost; //How it'll cost to fix the problem
string helper; //Name of person helping solve the problem
public:
problem (string a_name, string a_cost, string a_helper);
The .cpp file that goes with this header has this:
#include "problem.h"
problem::problem (string a_name, string a_cost, string a_helper) {
name = a_name;
cost = a_cost;
helper = a_helper;
}
But now I'm having trouble defining a vector in the main.cpp part of my program.
What I want is something like:
string person;
string value;
string assistant;
vector <problem> problems.push_back(person, value, assistant);
Note: person, value, and assistant change multiple times with my program.
This code won't work though. Any help I could get to fix this problem would be most appreciated.
Thank you.