#include <stdio.h>
#include <stdlib.h>
//rastgele erişimli dosya
struct ogrenci{
int no;
char ad[20];
float vize,finall;
};
void main()
{
struct ogrenci bilgi;
int i=1;
FILE *p=fopen("ogrenci.dat","r+");
if(p==NULL)
printf("dosya olusturulamadi");
else
{
fread(&bilgi,sizeof(struct ogrenci),1,p);
while(!feof(p))
{
if(bilgi.vize>=50)
{
bilgi.finall+=10;
fseek(p,99*sizeof(struct ogrenci),SEEK_SET);
fwrite(&bilgi,sizeof(struct ogrenci),1,p);
}
i++;
fseek(p,99*sizeof(struct ogrenci),SEEK_SET);
fread(&bilgi,sizeof(struct ogrenci),1,p);
}
}
}
#include <stdlib.h>
//rastgele erişimli dosya
struct ogrenci{
int no;
char ad[20];
float vize,finall;
};
void main()
{
struct ogrenci bilgi;
int i=1;
FILE *p=fopen("ogrenci.dat","r+");
if(p==NULL)
printf("dosya olusturulamadi");
else
{
fread(&bilgi,sizeof(struct ogrenci),1,p);
while(!feof(p))
{
if(bilgi.vize>=50)
{
bilgi.finall+=10;
fseek(p,99*sizeof(struct ogrenci),SEEK_SET);
fwrite(&bilgi,sizeof(struct ogrenci),1,p);
}
i++;
fseek(p,99*sizeof(struct ogrenci),SEEK_SET);
fread(&bilgi,sizeof(struct ogrenci),1,p);
}
}
}
Yorumlar
Yorum Gönder