currently I'm building a program which can take people contact and add it to a dat file.
However, when I tried to run the program, i got this
error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript
class Contact{
private:
int phones;
string email;
string name;
public:
void setname(string name);
string takename();
void setphone(int numbers);
int takephone();
void setemail(string mail);
string takeemail();
void Contact::setname(string name)
{
ofstream myfile;
myfile.open(CONTACTS);
if (myfile.is_open());
{
myfile<<name<<endl;
myfile.close();
}
}
int main(int argc, char* argv[])
{
vector <string> input;
Contact addingname;
if (argc == 2)
{
input.push_back(argv[1]);
cout<<"Ok, contact"<<" "<<input.at(i)<<" added "<<endl;
for(int j=0;j<input.size();j++)
{
addingname.setname(input.at[j]); //got error in this section
}
any idea how could this happen? I'm just get started to c++ ..