Commit c20eda42 authored by Zara Saldanha's avatar Zara Saldanha

Problem 10.2

parent 3996f484
......@@ -56,7 +56,8 @@ void process(char *root)
initq(&nameq);
enqueue(root,&nameq);
time_t latest = 0;
while (true != queue_empty(nameq)) {
peek_front(dname,nameq);
dequeue(&nameq);
......@@ -98,6 +99,10 @@ void process(char *root)
if(min>file_info.st_size){
min = file_info.st_size;
}
if (file_info.st_mtime > latest) {
strcpy(dName, dp->d_name);
latest = file_info.st_mtime;
}
sum = sum + file_info.st_size;
}
} // while
......@@ -109,6 +114,8 @@ void process(char *root)
printf(" the max file size is %d bytes\n",(int)max);
printf(" the min file size is %d bytes\n",(int)min);
printf(" the average file size is %f bytes\n",avg);
printf(" the file size that was most recently modified: %s\n",dName);
printf(" the file that was least recently modified is %f\n",avg);
}
// initialize queue data structure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment