Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 1.16 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "header.h"
  2. int main()
  3. {
  4.     int a,i,j,scegli,righe,colonne;
  5.     float elem;
  6.  
  7.     indice=0;
  8.     FILE *fp;
  9.     fp=fopen("matrice.txt","r");
  10.     if(fp==NULL)
  11.     {
  12.     printf("errore nell'apertura del file\n");
  13.     system("pause");
  14.     exit(1);
  15.         }
  16.     else
  17.     leggiMatricedafile(fp,&VettMatrici[0]);
  18.  
  19.  
  20.     fclose(fp);
  21.  
  22.     fp=fopen("MatriceB","ab+");
  23.     if(fp==NULL)
  24.     {
  25.     printf("errore nell'apertura del file\n");
  26.     system("pause");
  27.     exit(1);
  28.         }
  29.     else
  30.     fwrite(&VettMatrici[0],sizeof(float),1,fp);
  31.     fread(&VettMatrici[1],(leggiRighe(&VettMatrici[0])*leggiColonne(&VettMatrici[0]))*sizeof(float),1,fp);
  32.     fclose(fp);
  33.  
  34.  
  35.  
  36.     FILE *pf;
  37.     pf=fopen("matrice1.txt","w");
  38.     if(pf==NULL)
  39.     {
  40.     printf("errore nell'apertura del file\n");
  41.     system("pause");
  42.     exit(1);
  43.         }
  44.     else
  45.     scriviMatricesufile(pf,&VettMatrici[0]);
  46.  
  47.  
  48.     fclose(pf);
  49.  
  50.      CreaMatrice (&VettMatrici[2],leggiColonne(&VettMatrici[1]),leggiRighe(&VettMatrici[1]));
  51.     MatTrasposta(&VettMatrici[1],&VettMatrici[2]);
  52.  
  53.     stampaMatrice(&VettMatrici[1]);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.     system("pause");
  61.     return 0;
  62. }