Paste2 Logo
  1. // BY Red Skull 92
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.         char dir[100];
  7.         int n,g,conto=1,f=0,q=1,k=0;
  8.         printf("Inserisci la directory: ");
  9.         fgets(dir,sizeof(dir),stdin);
  10.         printf("#--Prima Funzione--#\n\n");
  11.         dir[strlen(dir)-1]=0;
  12.         n=strlen(dir);
  13.         if (dir[n-1]=='/') dir[n-1]=0;
  14.         for(g=0;g<=n;g++)
  15.         {
  16.                 if(dir[g]=='/')
  17.                 {
  18.                         if(g!=0) conto++;
  19.                 }
  20.         }
  21.         printf("Ho trovato %d directory\n\n",conto);
  22.         printf("#--Seconda Funzione--#\n\n");
  23.         putchar('|');
  24.         do{
  25.                 if(dir[f]!='/')
  26.                 {
  27.                         if(q == 0)
  28.                         {
  29.                                 for(g=0;g<k;g++)
  30.                                 {
  31.                                         putchar('_');
  32.                                 }
  33.                                 q=1;
  34.                         }
  35.                         putchar(dir[f]);
  36.                         f++;
  37.                 }
  38.                 else
  39.                 {
  40.                        
  41.                         putchar('\n');
  42.                         putchar('|');
  43.                         q=0;
  44.                         k++;
  45.                         f++;
  46.                 }  
  47.         }
  48.         while (f != n);
  49.         putchar('\n');
  50. }      
  51.  
  52.  

Esercizio sulle directory by Red Skull 92