Anadolu üniversitesi Elektronikten Kadir Emre Bahtiyar'ın emeğidir.
#include
#include
#include
#define limit 30
int main(){
struct hospital{
char *name[limit];
char *lname[limit];
int no;
};
struct hospital *arr;
int num,i,a;
FILE *f1;
printf("Welcome to Hospital Database Program!\n");
printf("**********************************************************************\n");
printf("Please enter how many patients you want to register : ");
scanf("%d",&num);
arr = (struct hospital*)malloc(num * sizeof (struct hospital));
for(i=0;i
printf("%d. Patient's Name: ",i+1);
scanf("%s",&arr[i].name);
printf("%d. Patient's Last Name: ",i+1);
scanf("%s",&arr[i].lname);
printf("%d. Patient's Registry Number: ",i+1);
scanf("%d",&arr[i].no);
printf("\n");
}
printf("Your Entrie(s) Are:\n");
for(i=0;i
printf("**********************************************************\n");
printf("%d. Patient's Name: %s\n",i+1,arr[i].name);
printf("%d. Patient's Last Name: %s\n",i+1,arr[i].lname);
printf("%d. Patient's Registry Number: %d\n",i+1,arr[i].no);
}
f1 = fopen ("logfile.txt","a+");
for(i=0;i
fprintf(f1,"**********************************************************\n");
fprintf(f1,"Patient's Name: %s\n",arr[i].name);
fprintf(f1,"Patient's Last Name: %s\n",arr[i].lname);
fprintf(f1,"Patient's Registry Number: %d\n",arr[i].no);
}
fclose (f1);
printf("\nYou can also find patient informations in the file named 'logfile.txt' in same \ndirectory with the program....\n");
printf("\nPress '1' to add more records or Press'2' to exit: ");
scanf("%d",&a);
if(a==1) main();
else if (a==2) printf("Goodbye! Have a nice day!...\n");
else printf("You have pressed a wrong button. Exitting from the program...\n");
return 0;
}
0 yorum:
Yorum Gönder