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{
	int phones;
	string email;
	string name;
	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;;
  if (myfile.is_open());
int main(int argc, char* argv[])
	vector <string> input;
	Contact addingname;
if (argc == 2)
	cout<<"Ok, contact"<<" "<<<<" added "<<endl;
for(int j=0;j<input.size();j++)
	addingname.setname([j]); //got error in this section

any idea how could this happen? I'm just get started to c++ ..

Take another look at this:[j].

.at is a function and thus to call a function you need to use the parenthesis, "()" ,
and not the square brakets, "[]".

Also do you really need to use .a()? You aren't even handling if it throws an error.
Just use input[j] instead.

This question has already been answered. Start a new discussion instead.