Finding an element in a vector of objects

Jun 9, 2021 at 8:22am
Hi guys!
I'm writing a program to create a simple database in C++.
This program compiles, but it doesn't print any data. I think the problem is in the input files, or the find_brigadier function.
https://onlinegdb.com/WozUrHk6V
Lots of thanks to all who reed this. As I mentioned before, the problem was in the input files. It works correctly only if you write Name_Surname or NameSurname instead of Name Surname in the inpute files.
Last edited on Jun 9, 2021 at 11:10am
Jun 9, 2021 at 8:30am
crueltyfree wrote:
This program compiles,


No it doesn't:
 In function 'int main()':
119:6: error: 'personname' was not declared in this scope
120:15: error: 'brigadiers' was not declared in this scope



Your main() says this
1
2
3
4
5
6
int main(){
cin>>personname;
for(int i=0;i<brigadiers.size();i++){
  				brigadiers[i].find_brigadier(personname);
			  }
}

There is no brigadiers container to find anything of an unspecified entity in!
Last edited on Jun 9, 2021 at 8:31am
Jun 9, 2021 at 8:57am
No, it compiles)
I've forgotten to give you some very important parts of the program, but now I have shared the link.
Topic archived. No new replies allowed.