complete example creating , updating and deleting a text file in C++
Hello From IQBAL , guys, we often come across situations to store little data in .txt file. in the code below i have covered: creating txt file to store records of employees showing records from the file(reading file) updating salary of the employee(updating specific text in the file) deleting old file when program runs. An Employee Class with needed Methods your comments and suggestions are welcomed #include <iostream> #include <string> #include <fstream> #include <streambuf> #include <bits/stdc++.h> using namespace std; class Employee{ public: void add(string code,string name,int salary) { cout<<"Employee: "<<name<<" with Salary :"<<salary<<" Addedd."; ofstream file; file.open ("employee.txt",std::ios_base::app); file <<code<<","<<name<<","<<salary<<";"; ...