A PHP Error was encountered

Severity: Warning

Message: fopen(/home/solutionspile.com/public_html/system/sessions/ci_sessioni3d914rn3e5qp5id535ntiqjalrm9qe5): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 176

Backtrace:

File: /home/solutionspile.com/public_html/index.php
Line: 367
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Failed to read session data: user (path: /home/solutionspile.com/public_html/system/sessions)

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home/solutionspile.com/public_html/index.php
Line: 367
Function: require_once

[Solved]: *) ALL QUESTIONS ARE C++ related *) Please refer
Home / Expert Answers / Computer Science / all-questions-are-c-related-please-refer-to-the-reference-for-a-better-understanding-ma-pa654

(Solved): *) ALL QUESTIONS ARE C++ related *) Please refer to the reference for a better understanding *) Ma ...



*) ALL QUESTIONS ARE C++ related

*) Please refer to the reference for a better understanding

*) Main objective is to alter the main.cpp file and complete the code of the Sort Class to make the program run successful

*) Make file must be included in order to combine employee.txt, main.cpp together

*) Attach the screenshot of the running program at the end and it should resemble as attached output example

 

Output example

\( \mathrm{g}+\mathrm{t}-\mathrm{C} \) - g sort. cpp
\( \mathrm{g}_{+} \)main.o sort.o original data :

Reference only:( Main.cpp, employee.txt)

Main.cpp

#include <iostream>

#include <fstream>

#include <iomanip>

#include <string.h>

 

using namespace std;

 

// class for employee

class Employee

{

public:

    string type;

    string SSN;

    string lastName;

    string firstName;

    string department;

    string role;

    double salary;

 

    // Default constructor

    Employee ()

    {

        type = "";

        SSN = "";

        lastName = "";

        firstName = "";

        department = "";

        role = "";

        salary = 0;

    }

 

    // Initializer

    void init(string t, string s, string l, string f, string d, string r, double s1)

    {

        type = t;

        SSN = s;

        lastName = l;

        firstName = f;

        department = d;

        role = r;

        salary = s1;

    }

 

    // Function to find the employee with the given SSN

    static int findEmployee(Employee *employees, int size, string SSN)

    {

        for (int i = 0; i < size; i++)

        {

            if (employees[i].SSN == SSN)

            {

                return i;

            }

        }

        return -1;

    }

 

    // Function to display the header of the table "Type SSN LastName FirstName Department Role Salary"

    static void displayHeader()

    {

        cout << "-----------------------------------------------------------------------------------------------------------------" << endl;

        cout << left << setw(10) << "Type" << setw(15) << "SSN" << setw(15) << "LastName" << setw(15) << "FirstName" << setw(15) << "Department" << setw(25) << "Role" << setw(15) << left << "Salary" << endl;

        cout << "-----------------------------------------------------------------------------------------------------------------" << endl;

    }

 

    // Function to display the information of the employee

    void display()

    {

        cout << left << setw(10) << type << setw(15) << SSN << setw(15) << lastName << setw(15) << firstName << setw(15) << department << setw(25) << role << setw(15) << left << setprecision(2) << fixed << salary << endl;

    }

};

 

int main()

{

    // Open file "explore.txt" in read mode

    ifstream inFile;

    inFile.open("employee.txt");

    if (!inFile)

    {

        cout << "Unable to open file";

        exit(1);

    }

 

    // Declare an array of Employee class

    Employee *employees = new Employee[100];

 

    // Declare variables

    string Type, SSN, LastName, FirstName, Department, Role;

    double Salary;

 

    // Read the file and store the information in the array

    int count = 0;

    while (!inFile.eof())

    {

        inFile >> Type;

        if (Type == "S")

        {

            inFile >> SSN >> LastName >> FirstName >> Department >> Role >> Salary;

            employees[count].init(Type, SSN, LastName, FirstName, Department, Role, Salary);

            count++;

        }

        else if (Type == "H")

        {

            inFile >> SSN >> LastName >> FirstName >> Department >> Role >> Salary;

            employees[count].init(Type, SSN, LastName, FirstName, Department, Role, Salary);

            count++;

        }

    }

 

    // Display the header

    Employee::displayHeader();

 

    // Display the information of the salaried employees first and the hourly employees

    for (int i = 0; i < count; i++)

    {

        if (employees[i].type == "S")

        {

            employees[i].display();

        }

    }

 

    for (int i = 0; i < count; i++)

    {

        if (employees[i].type == "H")

        {

            employees[i].display();

        }

    }

 

    // Ask user to enter an SSN and find the corresponding employee and display the information of that employee

    cout << "Enter an SSN: ";

    cin >> SSN;

    for (int i = 0; i < count; i++)

    {

        if (SSN == employees[i].SSN)

        {

            employees[i].display();

        }

    }

 

    // Close the file

    inFile.close();

}

 

employee.txt

24 25 26??????????????

\( \mathrm{g}+\mathrm{t}-\mathrm{C} \) - g sort. cpp \( \mathrm{g}_{+} \)main.o sort.o original data : 24 25 26


We have an Answer from Expert

View Expert Answer

Expert Answer


C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports differen
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe