Im writing about searching a room number deleting a line which includes wanted room number from txt in c++ but it deleting everything, what's wrong with it? And its all of false code, can you suggest me a new algorithm?
int sil;
cout << "Silmek istediğiniz oda numarası : ";
cin >> sil;
oda.Sil(sil);
fstream veriler,gecici;
veriler.open("Veriler.txt", ios::out || ios::in || ios::app);
gecici.open("Gecici.txt", ios::out || ios::in || ios::app);
while (!veriler.eof())
{
veriler >> oda.oda_Numara;
veriler >> oda.musteri_Ad;
veriler >> oda.musteri_Soyad;
veriler >> oda.oda_Ucret;
veriler >> oda.musteri_Kimlik;
veriler >> oda.musteri_Numara;
if (oda.oda_Numara == sil)
continue;
else
{
gecici << setw(20) << oda.oda_Numara
<< setw(20) << oda.musteri_Ad
<< setw(20) << oda.musteri_Soyad
<< setw(20) << oda.oda_Ucret
<< setw(20) << oda.musteri_Kimlik
<< setw(20) << oda.musteri_Numara
<< endl;
}
}
remove("Veriler.txt");
rename("Gecici.txt", "Veriler.txt");
gecici.close();