Documente Academic
Documente Profesional
Documente Cultură
K.VENKATSAI(16311A12L3)
K.SAGAR(16311A12L4)
K.SAIKUMAR(16311A12L5)
S.MONISHA(16311A12L6)
Mini project in C Personal Diary Management System is a console
application without graphics. In this project, user can keep their personal record
like they do in a diary. You can keep records of the important things you do in
your daily life, like meetings and various other tasks.
The basic user-defined functions used in this project are listed below:
In this project, you need to enter a password to view, edit or delete record.
Password is not required to view the main menu or to add record. We have used
password in other mini projects in Code with C; what’s little different in this
project is that you can edit the password within the application i.e., after
executing or upon running the project.
Your password is currently ‘Enter’ for this mini project. Don’t type e-n-t-e-r.
Press the Enter key!
Program :
#include<stdio.h> printf("\n\n\t\tMAIN MENU:");
struct record {
{ case 1:
}; case 3:
{ break;
printf("\n\n\t***********************************\n"); deleterecord();
getch(); if(fp==NULL)
exit(0); {
printf("\n\n\t\t***************************\n"); choice=1;
printf("\n\t\t***************************\n\n"); }
printf("\tENTER PLACE:"); {
gets(e.place); return ;
fflush(stdin); }
printf("\tENTER DURATION:"); do
gets(e.duration); {
} getch();
fclose ( fp ) ; return ;
getch(); system("cls");
printf("\nDURATION: scanf("%c",&choice);
%s",customer.duration);
}
printf("\nNOTE: %s",customer.note); while(choice=='Y'||choice=='y');
} return ;
break; }
fflush(stdin); {
printf("\nDUARATION: return ;
%s",customer.duration);
}
printf("\nNOTE: %s",customer.note);
do
}
{
}
printf("\n\tENTER THE DATE OF RECORD TO
break; BE EDITED:[yyyy-mm-dd]:");
default: fflush(stdin);
printf("\n7.GO BACK TO MAIN MENU.");
gets(filename);
do
printf("\n\tENTER TIME:[hh:mm]:");
{
gets(time);
printf("\n\tENTER YOUR CHOICE:");
fpte = fopen ( filename, "rb+" ) ;
fflush(stdin);
if ( fpte == NULL )
scanf("%d",&num);
{
fflush(stdin);
printf( "\nRECORD DOES NOT EXISTS:" ) ;
switch(num)
printf("\nPRESS ANY KEY TO GO BACK");
{
getch();
case 1:
return; printf("\nENTER THE NEW DATA:");
} printf("\nNEW TIME:[hh:mm]:");
printf("\n1.TIME."); gets(customer.duration);
case 7: fclose(fpte);
printf("\nPRESS ANY KEY TO GO
BACK...\n"); printf("\n\n\tWOULD YOU LIKE TO EDIT
ANOTHER RECORD.(Y/N)");
getch();
scanf("%c",&choice);
return ;
count++;
break;
}
default:
printf("\nYOU TYPED SOMETHING else
ELSE...TRY AGAIN\n");
{
break;
printf("\nTHE RECORD DOES NOT
} EXIST::\n");
fseek(fpte,-sizeof(customer),SEEK_CUR); scanf("%c",&choice);
fwrite(&customer,sizeof(customer),1,fpte); }
fseek(fpte,-sizeof(customer),SEEK_CUR); }
while(choice=='Y'||choice=='y');
fread(&customer,sizeof(customer),1,fpte);
fclose ( fpte ) ;
choice=5;
if(count==1)
break;
printf("\n%d FILE IS EDITED...\n",count);
}
else if(count>1)
}
printf("\n%d FILES ARE EDITED..\n",count);
i++;
else
pass[i]=getch();
printf("\nNO FILES EDITED...\n");
}
printf("\tPRESS ENTER TO EXIT EDITING
MENU."); }
getch(); pass[i]='\0';
} fpp=fopen("SE","r");
{ {
{ }
printf("\n\n\tWRONG fclose(fp);
PASSWORD..\n\n\tACCESS DENIED...\n");
check=password();
}
if(check==1)
}
{
printf("\n\n\t::YOU ENTERED WRONG
PASSWORD::YOU ARE NOT ALLOWED TO return ;
ACCESS ANY FILE::\n\n\tPRESS ANY KEY TO GO
BACK..."); }
getch(); do
return 1; {
} if(check==0)
void editpassword() {
{ i=0;
system("cls"); choice=0;
} return ;
} }
pass[i]='\0'; i=0;
i=0; while(pass[i]!='\0')
printf("\n\tCONFIRM PASSWORD:"); {
confirm[0]=getch(); ch=pass[i];
while(confirm[i]!='\r') putc(ch+5,fp);
{ i++;
if(confirm[i]=='\b') }
{ putc(EOF,fp);
i--; fclose(fp);
printf("\b"); }
printf("\b"); {
{ fflush(stdin);
scanf("%d",&choice); return ;
switch(choice) }
{ fptr=fopen("temp","wb");
case 1: if(fptr==NULL)
if ( fp == NULL ) return ;
{ }
while(fread(&file,sizeof(file),1,fp)==1)
if(strcmp(file.time,time)!=0)
fwrite(&file,sizeof(file),1,fptr);
fclose(fp);
fclose(fptr);
remove(filename);
rename("temp",filename);
printf("\nDELETED SUCCESFULLY...");
break;
default:
break;
}
while(choice<1||choice>2);
fflush(stdin);
scanf("%c",&another);
getch();
}
OUTPUT: