<vector>
                  
                  
                  struct Student
                  
                  
                  {
                  
                  
                    std::string name;
                  
                  
                    unsigned int age;
                  
                  
                  
                  
                  
                    Student(std::string _name, unsigned int _age) : name(_name), age(_age) {};
                  
                  
                  };
                  
                  
                  
                  
                  
                  void PrintStudents(std::vector<Student> st)
                  
                  
                  {
                  
                  
                    for (auto& s : st)
                  
                  
                    {
                  
                  
                      std::cout << s.name << L" : " << s.age << std::endl; // Error C2679 binary '<<': no operator found
                  
                  
                                                                           // which takes a right - hand operand of type
                  
                  
                                                                           // 'std::string' (or there is no acceptable conversion)
                  
                  
                  
                  
                  
                    }
                  
                  
                  }
                  
                  
                  
                  
                  
                  int wmain()
                  
                  
                  {
                  
                  
                    std::vector<Student> students;
                  
                  
                    students.push_back(Student("Ivanov", 18));
                  
                  
                    students.push_back(Student("Petrov", 20));
                  
                  
                    students.push_back(Student("Sidorov", 19));
                  
                  
                    PrintStudents(students);
                  
                  
                    return 0;
                  
                  
                  }
                  
                  
                
нет перегруженного оператора <<; можно либо убрать конструктор, раз структура используется, и воспользоваться агрегатной инициализацией Student{}, либо определить оператор <<
#include <string>
Он есть, просто не подключён
Ну и вообще то код не блещет совершенством... Подумай над деталями
Обсуждают сегодня