You are on page 1of 1

#include <iostream>

#include <fstream>
#include <string>
using namespace std;

int main()
{
string temp,*t; fstream log; string n="C";
int end=0;
int i=0;
log.open("data.txt");
log.seekg(0,ios::end);
i=log.tellg();
t=new string[i];
log.seekg(0,ios::beg);
i=0;
while(log.good())
{
getline(log,temp);
t[end]=temp;
cout<<t[end]<<endl;
end++;
}
log.close();
cout<<"\n\n\nAfter Deleting\n\n\n "<<endl;
i=0;
for(i=0;i<=6;i++)
{
if(n==t[i])
{
for(int j=i;j<end;j++)
{
t[j]=t[j+1];
}
end--;
break;
}
}
ofstream log1;
log1.open("data.txt");
for(int i=0;i<end;i++)
{
log1<<t[i]<<endl;
}
system("PAUSE");
return 0;
}

You might also like