Ubah 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;
}
}
}
iamcosmo