-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOgrenciKayitSistemi.cpp
670 lines (531 loc) · 18.7 KB
/
OgrenciKayitSistemi.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#pragma pack(1)
#define yapiboyutu sizeof(struct ogrenci)
FILE *dosya,*yedek; // fonksiyonlarda dosya islemleri yapılacağından global tanımladım
struct dtarih
{
int gun;
int ay;
int yil;
};
struct ogrenci
{
int num;
char ad[50];
char soyad[50];
struct dtarih bdate;
float mat;
float fen;
float trk;
};
struct ogrenci ogr;
void yenikayit(void);
void kayitsil(void);
void kayitguncelle(void);
void ogrencilistele(void);
void numaraya_gore_sirala(void);
void ada_gore_sirala(void);
void mat_gore_sirala(void);
void fen_gore_sirala(void);
void turkce_gore_sirala(void);
void sirali_kayitlari_yazdir(void);
void cikis(void);
int main(){
int sec;
do
{
system("cls");
printf("-------------MENU-------------:\n\n\n");
printf(" 1) Ogrenci kaydini eklemek\n 2) Ogrenci kaydini silmek\n 3) Ogrenci kaydini guncellemek\n 4) Tüm ogrencileri ekranda listelemek\n 5) Ogrenci numarasina gore kayitlari siralamak\n 6) Ogrenci ismine gore kayitlari siralamak\n 7) Matematik notuna gore siralama\n 8) Fen notuna gore siralama\n 9) Turkce notuna gore siralama\n 10) Sirali kayitlari sorted.bin dosyasina yazdirmak\n 11) Cikis");
printf("\n\nYapilmasini istediginiz islemi giriniz: ");
scanf("%d",&sec);
switch(sec)
{
case 1: { yenikayit(); break;}
case 2: { kayitsil(); break;}
case 3: { kayitguncelle(); break;}
case 4: { ogrencilistele(); break;}
case 5: { numaraya_gore_sirala(); break;}
case 6: { ada_gore_sirala(); break;}
case 7: { mat_gore_sirala(); break;}
case 8: { fen_gore_sirala(); break;}
case 9: { turkce_gore_sirala(); break;}
case 10:{ sirali_kayitlari_yazdir(); break;}
case 11:{ fclose(dosya); return 0;}
default:{ printf("!!! HATALI GIRIS !!!");}
}
}while(1);
getch();
return 0;
}
void yenikayit(void){
system("cls");
dosya=fopen("student.bin","a+b"); //a+ yaptım çünkü r+'da datayı her girişte boşaltıp yerine yazıyordu.
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
puts("\nOgrenci bilgilerini girin: ");
do // Önce bellege yazdırıyoruz.
{
fflush(stdin);
printf("\nAD: ");
scanf("%s",ogr.ad);
printf("\nSOYAD: ");
scanf("%s",ogr.soyad);
printf("\nOGRENCI NUMARASI: ");
scanf("%d",&ogr.num);
printf("\nDOGUM TARIHI: ");
scanf("%d/%d/%d",&ogr.bdate.gun,&ogr.bdate.ay,&ogr.bdate.yil);
printf("\nMATEMATIK NOTU: ");
scanf("%f",&ogr.mat);
printf("\nFEN BILGISI NOTU: ");
scanf("%f",&ogr.fen);
printf("\nTURKCE NOTU: ");
scanf("%f",&ogr.trk);
printf("\n");
//Sonra dosyaya yazdırıyoruz.
fprintf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,ogr.num,ogr.bdate.gun,ogr.bdate.ay,ogr.bdate.yil,ogr.mat,ogr.fen,ogr.trk);
puts("Yeni bir kayit icin herhangi bir tusa, cikmak icin ESC tusuna basiniz.");
}while(getch()!=27);
fclose(dosya);
puts("\nBilgiler kaydedildi devam etmek icin herhangi bir tusa basiniz.");
getch();
}
void kayitsil(void){
system("cls");
int numara,durum=0; //durum 1 olduğunda kayıt silinmiş demektir.
printf("\nSilinecek ogrencinin numarasini giriniz: ");
scanf("%d",&numara);
dosya=fopen("student.bin","r+b");// sinif dosyasından sadece okuma yapilacak bu yüzden r kullanıyoruz.
yedek = fopen("yedek.bin","w+b");// yedek dosyasına yazma islemi yapacağız.
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
while(!feof(dosya))
{
// dosyayı okuyoruz ve degerleri belleğe yazıyoruz
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,&ogr.num,&ogr.bdate.gun,&ogr.bdate.ay,&ogr.bdate.yil,&ogr.mat,&ogr.fen,&ogr.trk);
if(numara != ogr.num) //Okunan değer yedek dosyasına yazılır
{
fprintf(yedek,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,ogr.num,ogr.bdate.gun,ogr.bdate.ay,ogr.bdate.yil,ogr.mat,ogr.fen,ogr.trk);
}
else durum=1; // Numara okunan değere eşitse , okunan o değer yedek dosyasına yazılmaz böylece o değer silinmiş olur
}
fclose(dosya);
fclose(yedek);
if(durum == 1)
{
remove("student.bin"); //silmek icin
rename("yedek.bin","student.bin"); // isim değişikliği için
puts("Silme islemi tamamlandi, devam etmek icin bir tusa basin");
}
else // durum=1 değilse okunan değer silinmemiştir, daha doğrusu girilen numara dosyada bulunmamaktadır
{
remove("yedek.bin"); // yedek dosyasını kullanamadıgımızdan siliyoruz
printf("%d numarasinda bir ogrenci bulunamadi devam etmek icin bir tusa basin",numara);
}
fflush(stdin);
getch();
}
void kayitguncelle(void){
system("cls");
int numara,durum=0;//durum =0 ise değiştirme işlemi gerçekleşmemiştir.
printf("\nBilgilerini degistireceginiz ogrencinin numarasini giriniz: ");
scanf("%d",&numara);
dosya=fopen("student.bin","r+b");// sinif dosyasından sadece okuma yapilacak bu yüzden r kullanıyoruz.
yedek=fopen("yedek.bin","w+b");// yedek dosyasına yazma islemi yapacağız.
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
while(!feof(dosya))
{
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,&ogr.num,&ogr.bdate.gun,&ogr.bdate.ay,&ogr.bdate.yil,&ogr.mat,&ogr.fen,&ogr.trk);
if(numara != ogr.num) //Okunan değer yedek dosyasına yazılır
{
fprintf(yedek,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,ogr.num,ogr.bdate.gun,ogr.bdate.ay,ogr.bdate.yil,ogr.mat,ogr.fen,ogr.trk);
}
else //Değerler değiştirilir.
{
fflush(stdin);
int secim4;
printf("\n\t1- Ogrenci ad guncelleme\n\t2- Ogrenci soyad guncelleme\n\t3- Ogrenci numarasi guncelleme\n\t4- Ogrenci dogum tarihi guncelleme\n\t5- Ogrenci matematik notu guncelleme\n\t6- Ogrenci fen bilgisi notu guncelleme\n\t7- Ogrenci turkce notu guncelleme");
printf("\n\nYapmak istediginiz islemi seciniz: "); scanf("%d",&secim4);
switch(secim4)
{
case 1: {
printf("\nAD: "); scanf("%s",ogr.ad);
fprintf(yedek,"%s",ogr.ad);
break;
}
case 2: {
printf("\nSOYAD: "); scanf("%s",ogr.soyad);
fprintf(yedek,"%s",ogr.soyad);
break;
}
case 3: {
printf("\nNUMARA: "); scanf("%d",&ogr.num);
fprintf(yedek,"%d",ogr.num);
break;
}
case 4: {
printf("\nDOGUM TARIHI: "); scanf("%d/%d/%d",&ogr.bdate.gun,&ogr.bdate.ay,&ogr.bdate.yil);
fprintf(yedek,"%d/%d/%d",ogr.bdate.gun,ogr.bdate.ay,ogr.bdate.yil);
break;
}
case 5: {
printf("\nMATEMATIK NOTU: "); scanf("%.2f",&ogr.mat);
fprintf(yedek,"%.2f",ogr.mat);
break;
}
case 6: {
printf("\nFEN BILGISI NOTU: "); scanf("%.2f",&ogr.fen);
fprintf(yedek,"%.2f",ogr.fen);
break;
}
case 7: {
printf("\nTURKCE NOTU: "); scanf("%.2f",&ogr.trk);
fprintf(yedek,"%.2f",ogr.trk);
break;
}
default:{ printf("!!! HATALI GIRIS !!!");}
}
printf("\n");
durum=1; // değişme yapıldı.
}
}
fclose(dosya);
fclose(yedek);
if(durum == 1) //değişme islemi yapilirsa
{
remove("student.bin");
rename("yedek.bin","student.bin");
puts("Ogrenci bilgileri degistirildi devam etmek icin bir tusa basin");
}
else
{
remove("yedek.bin");
puts("Ilgili ogrenci bulunamadi devam etmek icin bir tusa basin");
}
fflush(stdin);
getch();
}
void ogrencilistele(void){
system("cls");
int i;
dosya=fopen("student.bin","r+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
printf("\n\n\t\t\t\t----KAYITLI OGRENCILER----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
while(!feof(dosya))
{
//fflush(stdout);
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr.ad,ogr.soyad,&ogr.num,&ogr.bdate.gun,&ogr.bdate.ay,&ogr.bdate.yil,&ogr.mat,&ogr.fen,&ogr.trk);
if(ogr.ad != NULL)
{
printf("\n%5s%13s%15d%9d/%d/%d%15.f%18.f%22.f",ogr.ad,ogr.soyad,ogr.num,ogr.bdate.gun,ogr.bdate.ay,ogr.bdate.yil,ogr.mat,ogr.fen,ogr.trk);
}
}
fclose(dosya);
printf("\n\n\nOgrenci bilgileri listelendi, devam etmek icin bir tusa basin");
getch();
}
void numaraya_gore_sirala(void){
struct ogrenci temp;
int kayitsayisi=0,i,j;
dosya=fopen("student.bin","a+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
fseek(dosya,0,SEEK_END);
kayitsayisi=ftell(dosya)/sizeof(struct ogrenci);
fseek(dosya,0,SEEK_SET);
fscanf(dosya,"%d",&kayitsayisi);
struct ogrenci ogr[kayitsayisi];
for(i=0; i<kayitsayisi; i++)
{
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,&ogr[i].num,&ogr[i].bdate.gun,&ogr[i].bdate.ay,&ogr[i].bdate.yil,&ogr[i].mat,&ogr[i].fen,&ogr[i].trk);
}
//sıralayalım
for(i=0;i<kayitsayisi;i++)
{
for(j=i+1;j<kayitsayisi;j++)
{
if(ogr[i].num>ogr[j].num)
{
temp=ogr[i];
ogr[i]=ogr[j];
ogr[j]=temp;
}
}
}
//dosyaya yazdıralım
for(i=0;i<kayitsayisi;i++)
{
fprintf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
system("cls");
printf("\n\n\t\t\t\t----NUMARAYA GORE SIRALI KAYITLI OGRENCILER----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
for(i=0;i<kayitsayisi;i++)
{
printf("\n%6s%11s%15d%10d/%d/%d%20f%20f%20f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
fclose(dosya);
printf("\n\n\nOgrenci listesi numaraya gore siralandi.");
getch();
}
void mat_gore_sirala(void){
struct ogrenci temp;
int kayitsayisi=0,i,j;
dosya=fopen("student.bin","r+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
fseek(dosya,0,SEEK_END);
kayitsayisi=ftell(dosya)/sizeof(struct ogrenci);
fseek(dosya,0,SEEK_SET);
fscanf(dosya,"%d",&kayitsayisi);
struct ogrenci ogr[kayitsayisi];
for(i=0; i<kayitsayisi; i++)
{
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,&ogr[i].num,&ogr[i].bdate.gun,&ogr[i].bdate.ay,&ogr[i].bdate.yil,&ogr[i].mat,&ogr[i].fen,&ogr[i].trk);
}
fclose(dosya);
for(i=0;i<kayitsayisi;i++)
{
for(j=i+1;j<kayitsayisi;j++)
{
if(ogr[i].mat>ogr[j].mat)
{
temp=ogr[i];
ogr[i]=ogr[j];
ogr[j]=temp;
}
}
}
for(i=0;i<kayitsayisi;i++)
{
fprintf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
system("cls");
printf("\n\n\t\t\t\t----MATEMATIK NOTUNA GORE SIRALI KAYITLI OGRENCILER----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
for(i=0;i<kayitsayisi;i++)
{
printf("\n%6s%11s%15d%10d/%d/%d%20f%20f%20f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
fclose(dosya);
printf("\n\n\nOgrenci listesi matematik notuna gore siralandi.");
getch();
}
void fen_gore_sirala(void){
struct ogrenci temp;
int kayitsayisi=0,i,j;
dosya=fopen("student.bin","r+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
fseek(dosya,0,SEEK_END);
kayitsayisi=ftell(dosya)/sizeof(struct ogrenci);
fseek(dosya,0,SEEK_SET);
fscanf(dosya,"%d",&kayitsayisi);
struct ogrenci ogr[kayitsayisi];
for(i=0; i<kayitsayisi; i++)
{
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,&ogr[i].num,&ogr[i].bdate.gun,&ogr[i].bdate.ay,&ogr[i].bdate.yil,&ogr[i].mat,&ogr[i].fen,&ogr[i].trk);
}
fclose(dosya);
for(i=0;i<kayitsayisi;i++)
{
for(j=i+1;j<kayitsayisi;j++)
{
if(ogr[i].fen>ogr[j].fen)
{
temp=ogr[i];
ogr[i]=ogr[j];
ogr[j]=temp;
}
}
}
for(i=0;i<kayitsayisi;i++)
{
fprintf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
system("cls");
printf("\n\n\t\t\t\t----FEN BILGISI NOTUNA GORE SIRALI KAYITLI OGRENCILER----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
for(i=0;i<kayitsayisi;i++)
{
if(ogr[i].fen != NULL)
printf("\n%6s%11s%15d%10d/%d/%d%20f%20f%20f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
fclose(dosya);
printf("\n\n\nOgrenci listesi fen bilgisi notuna gore siralandi.");
getch();
}
void turkce_gore_sirala(void){
struct ogrenci temp;
int kayitsayisi=0,i,j;
dosya=fopen("student.bin","r+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
fseek(dosya,0,SEEK_END);
kayitsayisi=ftell(dosya)/sizeof(struct ogrenci);
fseek(dosya,0,SEEK_SET);
fscanf(dosya,"%d",&kayitsayisi);
struct ogrenci ogr[kayitsayisi];
for(i=0; i<kayitsayisi; i++)
{
fscanf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,&ogr[i].num,&ogr[i].bdate.gun,&ogr[i].bdate.ay,&ogr[i].bdate.yil,&ogr[i].mat,&ogr[i].fen,&ogr[i].trk);
}
fclose(dosya);
for(i=0;i<kayitsayisi;i++)
{
for(j=i+1;j<kayitsayisi;j++)
{
if(ogr[i].trk>ogr[j].trk)
{
temp=ogr[i];
ogr[i]=ogr[j];
ogr[j]=temp;
}
}
}
for(i=0;i<kayitsayisi;i++)
{
fprintf(dosya,"%s %s %d %d/%d/%d %f %f %f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
system("cls");
printf("\n\n\t\t\t\t----TURKCE NOTUNA GORE SIRALI KAYITLI OGRENCILER----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
for(i=0;i<kayitsayisi;i++)
{
if(ogr[i].trk != NULL)
printf("\n%6s%11s%15d%10d/%d/%d%20f%20f%20f",ogr[i].ad,ogr[i].soyad,ogr[i].num,ogr[i].bdate.gun,ogr[i].bdate.ay,ogr[i].bdate.yil,ogr[i].mat,ogr[i].fen,ogr[i].trk);
}
fclose(dosya);
printf("\n\n\nOgrenci listesi turkce notuna gore siralandi.");
getch();
}
void ada_gore_sirala(void){
int kayitsayisi=0;
int x,y;
dosya=fopen("student.bin","a+b");
if(dosya==NULL)
{
dosya=fopen("student.bin","w+b");
}
fseek(dosya,0,SEEK_END);
kayitsayisi=ftell(dosya)/sizeof(struct ogrenci);
fscanf(dosya,"%d",&kayitsayisi);
struct ogrenci ogr[kayitsayisi];
struct ogrenci temp[kayitsayisi];
for (x=0; x<kayitsayisi; x++)
{
fread(&ogr[x],sizeof(ogr),1,dosya);
}
for (x = 1; x < kayitsayisi; x++)
{
for (y = 1; y < kayitsayisi; y++)
{
if (strcmp(ogr[y - 1].ad, ogr[y].ad) > 0)
{
temp[kayitsayisi]=ogr[y-1];
ogr[y-1]=ogr[y];
ogr[y]=temp[kayitsayisi];
}
}
}
system("cls");
printf("\n\n\t\t\t\t----ALFABETIK SIRALI OGRENCI KAYDI----\n");
printf("---------------------------------------------------------------------------------------------------------------\n");
printf(" ISIM SOYISIM NUMARA DOGUM TARIHI MATEMATIK NOTU FEN BILGISI NOTU TURKCE NOTU");
printf("\n---------------------------------------------------------------------------------------------------------------\n");
for (x = 0; x < kayitsayisi; x++)
printf("\n%6s%11s%15d%10d/%d/%d%20f%20f%20f",ogr[kayitsayisi].ad,ogr[kayitsayisi].soyad,ogr[kayitsayisi].num,ogr[kayitsayisi].bdate.gun,ogr[kayitsayisi].bdate.ay,ogr[kayitsayisi].bdate.yil,ogr[kayitsayisi].mat,ogr[kayitsayisi].fen,ogr[kayitsayisi].trk);
fclose(dosya);
printf("\n\n\nOgrenci bilgileri listelendi, devam etmek icin bir tusa basin");
getch();
}
void sirali_kayitlari_yazdir(void){
FILE *fp;
fp=fopen("sorted.bin","wb");
if(fp==NULL)
{
printf("dosya acilamadi");
exit(1);
}
int secim3;
do
{
system("cls");
printf("\n\n\t1- Ogrenci numarasina gore sirali kayit listesi\n\t2- Ogrenci ismine gore alfabetik sirali kayit listesi\n\t3- Matematik notuna gore sirali kayit listesi\n\t4- Fen notuna gore sirali kayit listesi\n\t5- Turkce notuna gore sirali kayit listesi");
printf("\n\nGORMEK ISTEDIGINIZ SIRALAMAYI SECINIZ: ");
scanf("%d",&secim3);
switch(secim3)
{
case 1: //numaraya göre
{
numaraya_gore_sirala();
fwrite(&ogr,sizeof(ogr),1,fp);
fclose(fp);
break;
}
case 2: //ada göre
{
ada_gore_sirala();
fwrite(&ogr,sizeof(ogr),1,fp);
fclose(fp);
break;
}
case 3: //mat göre
{
mat_gore_sirala();
fwrite(&ogr,sizeof(ogr),1,fp);
fclose(fp);
break;
}
case 4: //fen göre
{
fen_gore_sirala();
fwrite(&ogr,sizeof(ogr),1,fp);
fclose(fp);
break;
}
case 5: //trk göre
{
turkce_gore_sirala();
fwrite(&ogr,sizeof(ogr),1,fp);
fclose(fp);
break;
}
default:{ printf("!!! HATALI GIRIS !!!");}
}
}while(1);
printf("sorted.bin dosyasina yazdirildi.");
getch();
}