给定以下XML文件,完成算法流程图。

时间:2021-05-18 18:06:30

 

  
  
  
< FileSystem >
< DriverC >
< Dir DirName =”MSDOS622”>
<File FileName =” Command.com” ></ File >
</ Dir >
< File FileName =”MSDOS.SYS” ></ File >
< File FileName =” IO.SYS” ></ File >
</ DriverC >
</ FileSystem >

 

请画出遍历所有文件名(FileName)的流程图(请使用递归算法)。
答:

 

  
  
  
void FindFile( Directory d )
{
FileOrFolders
= d.GetFileOrFolders();
foreach ( FileOrFolder fof in FileOrFolders )
{
if ( fof is File )
You Found a file;
else if ( fof is Directory )
FindFile( fof );
}
}