Coding Global Background
Coding Global

I have 4 errors i have been trying to solve them it's been a week

Archiviert 2 years ago
3 Nachrichten
0 Mitglieder
2 years ago
In Discord öffnen
T
Tommy Emad
Verified

```c++ #pragma once #include <iostream> #include <vector> #include <sstream> #include <string> #include "Client.h" #include "Employee.h" #include "Admin.h" using namespace std; class Parser { public: static vector<string> split(string line) { vector<string> parts; istringstream ss(line); string part; while (getline(ss, part, ',')) { parts.push_back(part); } return parts; } static Client parseToClient(string line) { vector<string> parts = Parser::split(line); Client client; if (parts.size() == 5) { client.setID(stoi(parts[0])); client.setName(parts[1]); client.setAge(stoi(parts[2])); client.setPassword(parts[3]); client.setBalance(stod(parts[4])); } return client; } static Employee parseToEmployee(string line) { vector<string> parts = Parser::split(line); Employee employee; if (parts.size() == 5) { employee.setID(stoi(parts[0])); employee.setName(parts[1]); employee.setAge(stoi(parts[2])); employee.setPassword(parts[3]); employee.setSalary(stod(parts[4])); } return employee; } static Admin parseToAdmin(string line) { vector<string> parts = Parser::split(line); Admin admin; if (parts.size() == 5) { admin.setID(stoi(parts[0])); admin.setName(parts[1]); admin.setAge(stoi(parts[2])); admin.setPassword(parts[3]); admin.setSalary(stod(parts[4])); } return admin; } }; ```

Antworten (3)