SHARE
TWEET

Untitled

a guest Jan 21st, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define L 30
  4.  
  5. FILE *Aprifile (void);
  6. int vocali (char s[L]);
  7. int iniziale (char s[L]);
  8. /*
  9.  *
  10.  */
  11. int main(int argc, char** argv) {
  12.     FILE *t;
  13.     t=Aprifile();
  14.     while (feof(t)) {
  15.        
  16.     }
  17.    
  18.    
  19.     return (EXIT_SUCCESS);
  20. }
  21.  
  22. FILE *Aprifile (void)   {
  23.     char nomefile[L];
  24.     char c[L];
  25.     FILE *t;
  26.     int i=0;
  27.     printf("Inserire il nome del file da aprire:\n");
  28.     while ((nomefile[i]=getchar())!= '\n')  {
  29.         i++;
  30.     }
  31.     nomefile[i]='\0';
  32.     printf("Specificare la modalit√† di apertura del file:\n");
  33.     for(i=0;(c[i]=getchar())!= '\n';i++)  {
  34.        
  35.     }
  36.     c[i]='\0';
  37.    
  38.     t = fopen(nomefile,c);
  39.     if(t==NULL) {
  40.         printf("Errore apertura file");
  41.         return EXIT_FAILURE;
  42.     }
  43.    
  44.     return t;
  45. }
  46.  
  47. int vocali (char s[L])    {
  48.     int i=0,k=0,num=0;
  49.     char voc[10]={'A','a','E','e','I','i','O','o','U','u'};
  50.     while (s[i]!='\0')  {
  51.         for(k=0;k<10;k++)   {
  52.             if (s[i] == voc[k])   {
  53.                 num++;
  54.             }
  55.             i++;
  56.         }
  57.        
  58.     }
  59.     return i;
  60. }
  61. int iniziale (char s[L])    {
  62.     if (s[0]>='A'&& s[0]<='Z' )
  63.         return 1;
  64.     return 0;
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top