int numeri[10];
int numeri1[10];
int i=0;
FILE *f1;
void caricaNumeri(){
printf("digita dieci numeri interi\n");
for(i=0; i<10; i++){
scanf("%d",&numeri[i]);
}
}
void scriviNumeri(){
f1=fopen("filenumeri.txt", "w");
for(i=0; i<10; i++){
fprintf(f1,"%d\n",numeri[i]);
}
fclose(f1);
}
void leggi(){
f1=fopen("filenumeri.txt" , "r");
for(i=0; i<10; i++){
fscanf(f1,"%d",&numeri1[i]);
}
fclose(f1);
}
void stampa(){
for(i=0; i<10; i++){
printf("%d\n",numeri1[i]);
}
}
main(){
caricaNumeri();
scriviNumeri();
leggi();
stampa();
}
_______________________________________________________________________


Nessun commento:
Posta un commento