Horje
modify file CPP Code Example
modify file CPP
#include <iostream>
#include <string.h>
#include <fstream>

using namespace std;

int main()
{
ofstream outFile("temp.txt");
ifstream readFile("test.txt");

string readLine;
string search;
string firstName;
string lastName;

cout<<"Enter The Id :: ";
cin>>search;

while(getline(readFile,readLine))
{
    if(readLine == search)
    {
        outFile<<readLine;
        outFile<<endl;

        cout<<"Enter New First Name :: ";
        cin>>firstName;
        cout<<"Enter New Last Name :: ";
        cin>>lastName;

        outFile<<firstName<<endl;
        outFile<<lastName<<endl;
    }else{
        outFile<<readLine<<endl;
    }
}
}




Cpp

Related
constructor syntax in c++ Code Example constructor syntax in c++ Code Example
c++ classes Code Example c++ classes Code Example
range based for loop c++ Code Example range based for loop c++ Code Example
Valid Parentheses leetcode in c++ Code Example Valid Parentheses leetcode in c++ Code Example
stack data structure c++ Code Example stack data structure c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8