umitumit
22/06/2007, 15:28
Merhaba arkadaşlar,
programda kayit yaptıkdan sonra menüye geliyorum,
listele diyorum en son yaptıgım kayiti göstermio bu sorunu nasıll hallederim yardım edebilirimisin rica ediyorum
#include <stdio.h>
#include <conio.h>
typedef struct {
char ad[10],soyad[10];
int not1,not2,not3;
}kayit;
kayit ogrenci;
FILE * dsy;
void ekle()
{
clrscr();
dsy=fopen("deneme.bin","a+b");
printf("Ad:");
scanf("%s",ogrenci.ad);
printf("Soyad:");
scanf("%s",ogrenci.soyad);
printf("Not1:");
scanf("%d",ogrenci.not1);
printf("Not2:");
scanf("%d",ogrenci.not2);
printf("Not3:");
scanf("%d",ogrenci.not3);
fwrite(&ogrenci,sizeof(kayit),1,dsy);
}
void liste(void)
{
clrscr();
dsy=fopen("deneme.bin","rb");
fread(&ogrenci, sizeof(kayit), 1, dsy);
while (!feof(dsy)) {
printf("\nAd..: %s\n ", ogrenci.ad);
printf("\nSoyad..:%s\n ", ogrenci.soyad);
printf("--------------------");
fread(&ogrenci, sizeof(kayit), 1, dsy);
}
getch();
}
main()
{
clrscr();
char sec='H';
while(sec!='‡' && sec!='€')
{
clrscr();
printf("k-kay�t\n");
printf("a-ara\n");
printf("d-degis\n");
printf("s-sil\n");
printf("l-liste\n");
printf("€-c�k�s\n");
sec=getch();
clrscr();
switch(sec)
{
case 'k':
ekle();
sec='H';
break;
case 'l':
liste();
sec='H';
break;
}
}
}
programda kayit yaptıkdan sonra menüye geliyorum,
listele diyorum en son yaptıgım kayiti göstermio bu sorunu nasıll hallederim yardım edebilirimisin rica ediyorum
#include <stdio.h>
#include <conio.h>
typedef struct {
char ad[10],soyad[10];
int not1,not2,not3;
}kayit;
kayit ogrenci;
FILE * dsy;
void ekle()
{
clrscr();
dsy=fopen("deneme.bin","a+b");
printf("Ad:");
scanf("%s",ogrenci.ad);
printf("Soyad:");
scanf("%s",ogrenci.soyad);
printf("Not1:");
scanf("%d",ogrenci.not1);
printf("Not2:");
scanf("%d",ogrenci.not2);
printf("Not3:");
scanf("%d",ogrenci.not3);
fwrite(&ogrenci,sizeof(kayit),1,dsy);
}
void liste(void)
{
clrscr();
dsy=fopen("deneme.bin","rb");
fread(&ogrenci, sizeof(kayit), 1, dsy);
while (!feof(dsy)) {
printf("\nAd..: %s\n ", ogrenci.ad);
printf("\nSoyad..:%s\n ", ogrenci.soyad);
printf("--------------------");
fread(&ogrenci, sizeof(kayit), 1, dsy);
}
getch();
}
main()
{
clrscr();
char sec='H';
while(sec!='‡' && sec!='€')
{
clrscr();
printf("k-kay�t\n");
printf("a-ara\n");
printf("d-degis\n");
printf("s-sil\n");
printf("l-liste\n");
printf("€-c�k�s\n");
sec=getch();
clrscr();
switch(sec)
{
case 'k':
ekle();
sec='H';
break;
case 'l':
liste();
sec='H';
break;
}
}
}