File tree Expand file tree Collapse file tree 1 file changed +29
-13
lines changed
Expand file tree Collapse file tree 1 file changed +29
-13
lines changed Original file line number Diff line number Diff line change 11#include < iostream>
22#include < string>
33#include < set>
4+ #include < stdio.h>
45using namespace std ;
56#pragma warning(disable: 4996)
67
78bool stop = false ;
9+ int i =1 ;
10+ bool top_output = true ;
811
912void printItem (int hierachy, string item) {
10- for (int i = 0 ; i < hierachy; i++) {
13+ if (hierachy == 0 && top_output) {
14+ cout<<" DATA SET " << i << endl;
15+ i++;
16+ top_output = false ;
17+ }
18+
19+ for (int i = 0 ; i < hierachy; i++) {
1120
1221 cout << " | " ;
1322 }
1423 cout << item << endl;
1524}
1625
1726void presentFile (int hierachy, string curDir) {
18-
1927 set<string> Files;
20- printItem (hierachy, curDir);
2128 string item;
2229 while (cin>>item)
2330 {
@@ -26,23 +33,32 @@ void presentFile(int hierachy, string curDir) {
2633 for (i=Files.begin (); i != Files.end (); i++) {
2734 printItem (hierachy, *i);
2835 }
36+ if (item == " *" ) {
37+ top_output=true ;
38+ cout<<endl;
39+ }
40+ return ;
41+ }
42+ if (item == " #" ) {
43+ stop = true ;
44+ break ;
2945 return ;
3046 }
31- if (item[0 ] == ' f' )
47+ if (item[0 ] == ' f' ) {
3248 Files.insert (item);
33- else if ( item[0 ] == ' d' )
49+ // cout<<"get one file"<<endl;
50+ }
51+ else if ( item[0 ] == ' d' ) {
3452 presentFile (hierachy + 1 , item);
53+ printItem (hierachy, curDir);
54+ // cout<<"get one fir"<<endl;
55+ }
56+
3557 }
3658}
3759int main () {
38- int i =1 ;
3960 while (!stop) {
40- cout<<" DATA SET " << i << endl;
4161 presentFile (0 , " ROOT" );
42- cout<<endl;
43- i++;
44- char a = cin.get ();
45- char b = cin.peek ();
4662 }
47-
48- }
63+ return 0 ;
64+ }
You can’t perform that action at this time.
0 commit comments