小编Noo*_*hry的帖子

按姓氏排序列表

Jason Chimera SE 7039990101

Mike Knuble SSE 7039990102

Karl Alzner JSE 7039990202

Tom Poti SE 7039990203

Alex Ovechkin EGM 7039990001

我试图从文件中读取上述信息并按姓氏排序.我该如何解决这个错误:

错误:预期':'

我在EmployeeInformation类中声明的字符串?

 class EmployeeInformation {
  public string firstName;
  public string lastName;
  public string title;
  public string phonenumber;

EmployeeInformation(&firstName, &lastName, &title, &phonenumber)
{
    this->firstName = firstName;
    this->lastName = lastName;
    this->initials = title;
    this->id = phoneumber;
}
};


 #include <vector>
 #include <algorithm>
 #include <iostream>
 #include <fstream>

 using namespace std;

int main(int argc, char**argv) {

ifstream file;
file.open("employees.txt");

if (!file.is_open())
    cout << …
Run Code Online (Sandbox Code Playgroud)

c++ sorting

2
推荐指数
1
解决办法
2336
查看次数

标签 统计

c++ ×1

sorting ×1