#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
char cev;
struct pers{
char ad[10];
char soyad[10];
char telno[10];
}PERS;
int main (int argc,char* argv[])
{
void KAYIT(void);
void EKLE(void);
void DOK(void);
void GUNCEL(void);
void SIL(void);
void cerceve(int x1,int y1,int x2,int y2);
do{ clrscr(); textcolor(GREEN);
cerceve(1,1,80,24);cerceve(3,2,78,4);cerceve(3,5,20,20);
cerceve(22,5,60,7);cerceve(22,8,60,23);cerceve(62,5,78,20);
cerceve(3,21,20,23);cerceve(62,21,78,23);textcolor(WHITE);
gotoxy(15,3);printf("OZTURK HOLDING A.S. PERSONEL TELEFON TAKIP PROGRAMI");
gotoxy(32,6);printf("OZTURK HOLDING A.S.");
gotoxy(30,9);printf("1.KAYIT YAPMA");
gotoxy(30,11);printf("2.KAYIT EKLEME");
gotoxy(30,13);printf("3.DOKUMAN");
gotoxy(30,15);printf("4.KAYIT GUNCELLEME");
gotoxy(30,17);printf("5.KAYIT SILME");
gotoxy(30,19);printf("6.CIKIS");
gotoxy(30,21);printf("SECIMINIZ [1..6]");
cev=getche();
switch(cev)
{
case '1':KAYIT();break;
case '2':EKLE();break;
case '3':DOK();break;
case '4':GUNCEL();break;
case '5':SIL();break;
case '6':exit(0);
default:printf("SECIMINIZ HATALI!!...");
}
gotoxy(22,19);printf("ISLEME DEVAM EDILSINMI? E/H..");
cev=getche();
}while(cev=='E'|| cev=='e');
}
void cerceve(int x1,int y1,int x2,int y2)
{
int k;
gotoxy(x1,y1);putch(201);
for (k=(x1+1);k<(x2-1);k++)
putch(205);
putch(187);
for (k=(y1+1);k<(y2);k++)
{
gotoxy(x1,k);putch(186);
gotoxy(x2-1,k);putch(186);
}
gotoxy(x1,y2);putch(200);
for (k=(x1+1);k<(x2-1);k++)
putch(205);
putch(188);
}
void KAYIT(void)
{
FILE *fp;
fp=fopen("telf.txt","w");
clrscr();
if (fp==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
do{ cerceve(10,5,70,15);
gotoxy(15,7);printf("ADINIZ:");scanf("%s",PERS.ad);
gotoxy(15,9);printf("SOYADINIZ:");scanf("%s",PERS.soyad);
gotoxy(15,11);printf("TELEFON NO:");scanf("%s",PERS.telno);
fwrite(&PERS,sizeof(PERS),1,fp);
gotoxy(15,13);printf("KAYITA DEVAM EDILSINMI? E/H..");
cev=getche();
}while (cev=='E'||cev=='e');
fclose(fp);
}
void EKLE(void)
{
FILE *fp;
fp=fopen("telf.txt","a");
clrscr();
if (fp==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
do{ cerceve(10,5,70,15);
gotoxy(15,7);printf("ADINIZ:");scanf("%s",PERS.ad);
gotoxy(15,9);printf("SOYADINIZ:");scanf("%s",PERS.soyad);
gotoxy(15,11);printf("TELEFON NO:");scanf("%s",PERS.telno);
fwrite(&PERS,sizeof(PERS),1,fp);
gotoxy(15,13);printf("KAYITA DEVAN EDILSINMI? E/H..");
cev=getche();
}while (cev=='E'|| cev=='e');
fclose(fp);
}
void DOK(void)
{
FILE *fp;
fp=fopen("telf.txt","r");
clrscr();
if (fp==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
while (!feof(fp) && fread(&PERS,sizeof(PERS),1,fp)==1)
{
printf("\n %s %s %s",PERS.ad,PERS.soyad,PERS.telno);
}
fclose(fp);
}
void SIL(void)
{
FILE *fp;
FILE *fp1;
fp=fopen("telf.txt","r");
clrscr();
if (fp==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
fp1=fopen("tely.txt","w");
if (fp1==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
while(!feof(fp)&& fread(&PERS,sizeof(PERS),1,fp)==1)
{
printf("\n %s %s %s",PERS.ad,PERS.soyad,PERS.telno);
printf("\n BU KAYIT SILINECEKMI? E/H..");
cev=getche();
if (cev=='e'||cev=='E');else
fwrite(&PERS,sizeof(PERS),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("telf.txt");
rename("telfy.txt","telf.txt");
}
void GUNCEL(void)
{
FILE *fp;
FILE *fp1;
fp=fopen("telf.txt","r");
clrscr();
if (fp==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
fp1=fopen("telfy.txt","w");
if (fp1==NULL) {gotoxy(25,15);printf("DOSYA BULUNAMADI!!..");}
while(!feof(fp)&& fread(&PERS,sizeof(PERS),1,fp)==1)
{
printf("\n %s %s %s",PERS.ad,PERS.soyad,PERS.telno);
printf("\n YENI TELEFON NUMARASINI GIRINIZ:");
scanf("%s",PERS.telno);
fwrite(&PERS,sizeof(PERS),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("telf.txt");
rename("telfy.txt","telf.txt");
}