-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdel.txt
64 lines (60 loc) · 1.26 KB
/
del.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
void del(string name)
{
string type;
int P=0,i;
int K[10];
for(i=0;i<n;i++)
{
if(filenm[i].name==name)
{
K[P]=i;
P++;
}
}
if(P==0)
{
cout<<"Sorry, No such File Exists!!"<<"\n"<<"\n";
disp();
}
if(P==1)
{
int index=K[0];
for(i=index;i<n-1;i++)
{
filenm[i]=filenm[i+1];
}
n=n-1;
disp();
cout<<"\n"<<"File deleted.."<<"\n"<"\n";
}
if(P>1)
{
cout<<"There are "<<P<< Files exist with the same Name,Please give the file type:";
cin>>type;
int lm=0;
for(i=0;i<P;i++)
{
int index=K[i];
cout<<filenm[index].type;
if(filenm[index].type==type)
{
lm++;
for(i=index;i<n-1;i++)
{
filenm[i]=filenm[i+1];
}
n=n-1;
break;
}
}
if(lm!=0)
{
disp();
cout<<"\n"<<"File deleted.."<<"\n"<"\n";
}
if(lm==0)
{
cout<<"\n"<<"Sorry no such file Exists!"<<"\n"<<"\n";
disp();
}
}