#include #define NMAX 100 struct elemento { float val; int pos[2]; }; void leggimat(float m[NMAX][NMAX],int *r, int *c); void stampamat(float m[NMAX][NMAX],int r, int c); void vettori(float m[NMAX][NMAX],int r, int c, float v1[],float v2[], int *n); void ordina(float v[], int n); float prodscal(float v1[], float v2[], int n); void creastruct(struct elemento vet[], int *n, float mat[NMAX][NMAX], int r, int c); int main() { float mat[NMAX][NMAX]; float v1[NMAX], v2[NMAX]; int r,c,n; int ps; struct elemento vettore[NMAX]; leggimat(mat,&r,&c); stampamat(mat,r,c); vettori(mat,r,c,v1,v2,&n); ordina(v1,n); ordina(v2,n); ps = prodscal(v1,v2,n); int k; creastruct(vettore,&k,mat,r,c); FILE *fp=fopen("output.bin","w"); if(fp!=NULL) { fwrite(vettore,sizeof(struct elemento), k,fp); fclose(fp); } } void stampamat(float m[NMAX][NMAX],int r, int c) { for(int i=0;iv[j+1]) { int temp=v[j]; v[j]=v[j+1]; v[j+1]=temp; } } float prodscal(float v1[], float v2[], int n) { int ps=0; for(int i=0;i