SlideShare a Scribd company logo
1 of 33
Password Protected
Personal Diary
CP Project

Sir Faisal Ahmed
12/21/2013
Password Protected Personal Diary
2013

RAO MOUEED AHMED
18304(BE(EE))
MUHAMMAD YASIN KHAN
(BE(EE))
th
4 Semester
IQRA UNIVERSITY

2
Password Protected Personal Diary
2013

About Program
As eminent by its name that it should be an ordinary personal diary but in reality it
is not. This program is very useful for many professional persons for instance;
It is quite useful for doctors. Doctors can use it for taking appointments and
also they can keep the record of his patients as long as he can.
The travelers also use it for their purposes, what is their next plan? Where
they have to go further? And also they can save their memories of the
journey etc, for instances.

Features of Program
Following are the features of the program:
The most important feature is that it is the password protected. This program
is also capable of changing the password as many times as you can.
This program has a capability of storing unlimited (depends on the memory)
records.
The user can also take a look on his records.
The user can also make changes in the record.
The user has a power of deleting any record.

1
Password Protected Personal Diary
2013

Header Files Used in the Program
stdio.h
stdio.h is the name of the package for Standard Input / Output. This is
necessary for getting input from users and outputting text to the screen.
Also we use it for file handling.

stdlib.h
stdlib.h is the header of the general purpose standard library of C
programming language which includes functions involving memory
allocation, process control, conversions and others.

Use
For process control such as system(),exit().
Also used for defining NULL macro.

Conio.h
conio.h header used in c programming contains functions for console
input/output. We use this header file for following functions:
clrscr() clearing screen.
getch() for getting character from the user.

String.h
C string handling refers to a group of functions implementing operations on
strings in the C standard library. We use this header file for following
functions:
strcmp() String comparison.
strcpy() copy the string.

2
Password Protected Personal Diary
2013

Brief Description of Coding
Main Function ( main( ) )

3
Password Protected Personal Diary
2013

4
Password Protected Personal Diary
2013

Password Function
This function provides the password facility.

5
Password Protected Personal Diary
2013

6
Password Protected Personal Diary
2013

Add Record Function
Through this function we can add records as much as we can.

7
Password Protected Personal Diary
2013

8
Password Protected Personal Diary
2013

View Record Function
This function helps in viewing records.

9
Password Protected Personal Diary
2013

10
Password Protected Personal Diary
2013

Edit Record Function
This function facilitates the editing environment.

11
Password Protected Personal Diary
2013

12
Password Protected Personal Diary
2013

Edit Password Function
Through this function we can edit or change the password.

13
Password Protected Personal Diary
2013

14
Password Protected Personal Diary
2013

Delete Record Function
This function helps in deleting any record.

15
Password Protected Personal Diary
2013

The Coding
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
int password();
void addrecord();
void viewrecord();
void editrecord();
void editpassword();
void deleterecord();
struct record
{
char time[6];
char name[30];
char place[25];
char duration[10];
char note[500];
};
int main()
{
clrscr();
int ch;
printf("nnt***********************************n");
printf("t*PASSWORD PROTECTED PERSONAL DIARY*n");
printf("t***********************************");
while(1)
{
printf("nnttMAIN MENU:");
printf("nntADD RECORDt[1]");
printf("ntVIEW RECORDt[2]");
printf("ntEDIT RECORDt[3]");
printf("ntDELETE RECORDt[4]");
printf("ntEDIT PASSWORDt[5]");
printf("ntEXITtt[6]");
printf("nntENTER YOUR CHOICE:");

16
Password Protected Personal Diary
2013

scanf("%d",&ch);
switch(ch)
{
case 1:
addrecord();
break;
case 2:
viewrecord();
break;
case 3:
editrecord();
break;
case 4:
deleterecord();
break;
case 5:
editpassword();
break;
case 6:
printf("nnttTHANK YOU FOR USING THE SOFTWARE BY:RAO
MOUEED AHMED");
getch();
exit(0);
default:
printf("nYOU ENTERED WRONG CHOICE..");
printf("nPRESS ANY KEY TO TRY AGAIN");
getch();
break;
}
system("cls");
}
return 0;
}
void addrecord( )
{
system("cls");
FILE *fp ;
char another = 'Y' ,time[10];
struct record e ;
char filename[15];

17
Password Protected Personal Diary
2013

int choice;
printf("nntt***************************n");
printf("tt* WELCOME TO THE ADD MENU *");
printf("ntt***************************nn");
printf("nntENTER DATE OF YOUR RECORD:[yyyy-mm-dd]:");
fflush(stdin);
gets(filename);
fp = fopen (filename, "ab+" ) ;
if ( fp == NULL )
{
fp=fopen(filename,"wb+");
if(fp==NULL)
{
printf("nSYSTEM ERROR...");
printf("nPRESS ANY KEY TO EXIT");
getch();
return ;
}
}
while ( another == 'Y'|| another=='y' )
{
choice=0;
fflush(stdin);
printf ( "ntENTER TIME:[hh:mm]:");
scanf("%s",time);
rewind(fp);
while(fread(&e,sizeof(e),1,fp)==1)
{
if(strcmp(e.time,time)==0)
{
printf("ntTHE RECORD ALREADY EXISTS.n");
choice=1;
}
}
if(choice==0)
{
strcpy(e.time,time);
printf("tENTER NAME:");
fflush(stdin);
gets(e.name);

18
Password Protected Personal Diary
2013

fflush(stdin);
printf("tENTER PLACE:");
gets(e.place);
fflush(stdin);
printf("tENTER DURATION:");
gets(e.duration);
fflush(stdin);
printf("tNOTE:");
gets(e.note);
fwrite ( &e, sizeof ( e ), 1, fp ) ;
printf("nYOUR RECORD IS ADDED...n");
}
printf ( "ntADD ANOTHER RECORD...(Y/N) " ) ;
fflush ( stdin ) ;
another = getchar( ) ;
}
fclose ( fp ) ;
printf("nntPRESS ANY KEY TO EXIT...");
getch();
}
void viewrecord( )
{
FILE *fpte ;
system("cls");
struct record customer ;
char time[6],choice,filename[14];
int ch;
printf("nntt*******************************n");
printf("tt* HERE IS THE VIEWING MENU *");
printf("ntt*******************************nn");
choice=password();
if(choice!=0)
{
return ;
}
do
{
printf("ntENTER THE DATE OF RECORD TO BE VIEWED:[yyyy-mm-dd]:");
fflush(stdin);
gets(filename);

19
Password Protected Personal Diary
2013

fpte = fopen ( filename, "rb" ) ;
if ( fpte == NULL )
{
puts ( "nTHE RECORD DOES NOT EXIST...n" ) ;
printf("PRESS ANY KEY TO EXIT...");
getch();
return ;
}
system("cls");
printf("ntHOW WOULD YOU LIKE TO VIEW:n");
printf("nt1.WHOLE RECORD OF THE DAY.");
printf("nt2.RECORD OF FIX TIME.");
printf("nttENTER YOUR CHOICE:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("nTHE WHOLE RECORD FOR %s IS:",filename);
while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 )
{
printf("n");
printf("nTIME: %s",customer.time);
printf("nMEETING WITH: %s",customer.name);
printf("nMEETING AT: %s",customer.place);
printf("nDURATION: %s",customer.duration);
printf("nNOTE: %s",customer.note);
printf("n");
}
break;
case 2:
fflush(stdin);
printf("nENTER TIME:[hh:mm]:");
gets(time);
while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 )
{
if(strcmp(customer.time,time)==0)
{
printf("nYOUR RECORD IS:");
printf("nTIME: %s",customer.time);
printf("nMEETING WITH: %s",customer.name);

20
Password Protected Personal Diary
2013

printf("nMEETING AT: %s",customer.place);
printf("nDUARATION: %s",customer.duration);
printf("nNOTE: %s",customer.note);
}
}
break;
default: printf("nYOU TYPED SOMETHING ELSE...n");
break;
}
printf("nnWOULD YOU LIKE TO CONTINUE VIEWING...(Y/N):");
fflush(stdin);
scanf("%c",&choice);
}while(choice=='Y'||choice=='y');
fclose ( fpte ) ;
return ;
}
void editrecord()
{
system("cls");
FILE *fpte ;
struct record customer ;
char time[6],choice,filename[14];
int num,count=0;
printf("nntt*******************************n");
printf("tt* WELCOME TO THE EDITING MENU *");
printf("ntt*******************************nn");
choice=password();
if(choice!=0)
{
return ;
}
do
{
printf("ntENTER THE DATE OF RECORD TO BE EDITED:[yyyy-mm-dd]:");
fflush(stdin);
gets(filename);
printf("ntENTER TIME:[hh:mm]:");
gets(time);
fpte = fopen ( filename, "rb+" ) ;
if ( fpte == NULL )

21
Password Protected Personal Diary
2013

{
printf( "nRECORD DOES NOT EXISTS:" ) ;
printf("nPRESS ANY KEY TO GO BACK");
getch();
return;
}
while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 )
{
if(strcmp(customer.time,time)==0)
{
printf("nYOUR OLD RECORD WAS AS:");
printf("nTIME: %s",customer.time);
printf("nMEETING WITH: %s",customer.name);
printf("nMEETING AT: %s",customer.place);
printf("nDURATION: %s",customer.duration);
printf("nNOTE: %s",customer.note);
printf("nnttWHAT WOULD YOU LIKE TO EDIT..");
printf("n1.TIME.");
printf("n2.MEETING PERSON.");
printf("n3.MEETING PLACE.");
printf("n4.DURATION.");
printf("n5.NOTE.");
printf("n6.WHOLE RECORD.");
printf("n7.GO BACK TO MAIN MENU.");
do
{
printf("ntENTER YOUR CHOICE:");
fflush(stdin);
scanf("%d",&num);
fflush(stdin);
switch(num)
{
case 1: printf("nENTER THE NEW DATA:");
printf("nNEW TIME:[hh:mm]:");
gets(customer.time);
break;
case 2: printf("nENTER THE NEW DATA:");
printf("nNEW MEETING PERSON:");
gets(customer.name);
break;

22
Password Protected Personal Diary
2013

case 3: printf("nENTER THE NEW DATA:");
printf("nNEW MEETING PLACE:");
gets(customer.place);
break;
case 4: printf("nENTER THE NEW DATA:");
printf("nDURATION:");
gets(customer.duration);
break;
case 5: printf("ENTER THE NEW DATA:");
printf("nNOTE:");
gets(customer.note);
break;
case 6: printf("nENTER THE NEW DATA:");
printf("nNEW TIME:[hh:mm]:");
gets(customer.time);
printf("nNEW MEETING PERSON:");
gets(customer.name);
printf("nNEW MEETING PLACE:");
gets(customer.place);
printf("nDURATION:");
gets(customer.duration);
printf("nNOTE:");
gets(customer.note);
break;
case 7: printf("nPRESS ANY KEY TOGOBACK...n");
getch();
return ;
break;
default: printf("nYOU TYPED SOMETHING ELSE...TRY
AGAINn");
break;
}
}while(num<1||num>8);
fseek(fpte,-sizeof(customer),SEEK_CUR);
fwrite(&customer,sizeof(customer),1,fpte);
fseek(fpte,-sizeof(customer),SEEK_CUR);
fread(&customer,sizeof(customer),1,fpte);
choice=5;
break;
}

23
Password Protected Personal Diary
2013

}
if(choice==5)
{
system("cls");
printf("nttEDITING COMPLETED...n");
printf("--------------------n");
printf("THE NEW RECORD IS:n");
printf("--------------------n");
printf("nTIME: %s",customer.time);
printf("nMEETING WITH: %s",customer.name);
printf("nMEETING AT: %s",customer.place);
printf("nDURATION: %s",customer.duration);
printf("nNOTE: %s",customer.note);
fclose(fpte);
printf("nntWOULD YOU LIKE TO EDIT ANOTHER RECORD.(Y/N)");
scanf("%c",&choice);
count++;
}
else
{
printf("nTHE RECORD DOES NOT EXIST::n");
printf("nWOULD YOU LIKE TO TRY AGAIN...(Y/N)");
scanf("%c",&choice);
}
}while(choice=='Y'||choice=='y');
fclose ( fpte ) ;
if(count==1)
printf("n%d FILE IS EDITED...n",count);
else if(count>1)
printf("n%d FILES ARE EDITED..n",count);
else
printf("nNO FILES EDITED...n");
printf("tPRESS ENTER TO EXIT EDITING MENU.");
getch();
}
int password()
{
char pass[15]={0},check[15]={0},ch;
FILE *fpp;
int i=0,j;

24
Password Protected Personal Diary
2013

printf("::FOR SECURITY PURPOSE::");
printf("::ONLY THREE TRIALS ARE ALLOWED::");
for(j=0;j<3;j++)
{
i=0;
printf("nntENTER THE PASSWORD:");
pass[0]=getch();
while(pass[i]!='r')
{
if(pass[i]=='b')
{
i--;
printf("b");
printf(" ");
printf("b");
pass[i]=getch();
}
else
{
printf("*");
i++;
pass[i]=getch();
}
}
pass[i]='0';
fpp=fopen("SE","r");
if (fpp==NULL)
{
printf("nERROR WITH THE SYSTEM FILE...[FILE MISSING]n");
getch();
return 1;
}
else
i=0;
while(1)
{
ch=fgetc(fpp);
if(ch==EOF)
{
check[i]='0';

25
Password Protected Personal Diary
2013

break;
}
check[i]=ch-5;
i++;
}
if(strcmp(pass,check)==0)
{
printf("nntACCESS GRANTED...n");
return 0;
}
else
{
printf("nntWRONG PASSWORD..nntACCESS DENIED...n");
}
}
printf("nnt::YOU ENTERED WRONG PASSWORD::YOU ARE NOT ALLOWED TO
ACCESS ANY FILE::nntPRESS ANY KEY TO GO BACK...");
getch();
return 1;
}
void editpassword()
{
system("cls");
printf("n");
char pass[15]={0},confirm[15]={0},ch;
int choice,i,check;
FILE *fp;
fp=fopen("SE","rb");
if(fp==NULL)
{
fp=fopen("SE","wb");
if(fp==NULL)
{
printf("SYSTEM ERROR...");
getch();
return ;
}
fclose(fp);
printf("nSYSTEM RESTORED...nYOUR PASSWORD IS 'ENTER'n PRESS ENTER
TO CHANGE PASSWORDnn");

26
Password Protected Personal Diary
2013

getch();
}
fclose(fp);
check=password();
if(check==1)
{
return ;
}
do
{
if(check==0)
{
i=0;
choice=0;
printf("nntENTER THE NEW PASSWORD:");
fflush(stdin);
pass[0]=getch();
while(pass[i]!='r')
{
if(pass[i]=='b')
{
i--;
printf("b");
printf(" ");
printf("b");
pass[i]=getch();
}
else
{
printf("*");
i++;
pass[i]=getch();
}
}
pass[i]='0';
i=0;
printf("ntCONFIRM PASSWORD:");
confirm[0]=getch();
while(confirm[i]!='r')
{

27
Password Protected Personal Diary
2013

if(confirm[i]=='b')
{
i--;
printf("b");
printf(" ");
printf("b");
confirm[i]=getch();
}
else
{
printf("*");
i++;
confirm[i]=getch();
}
}
confirm[i]='0';
if(strcmp(pass,confirm)==0)
{
fp=fopen("SE","wb");
if(fp==NULL)
{
printf("nttSYSTEM ERROR");
getch();
return ;
}
i=0;
while(pass[i]!='0')
{
ch=pass[i];
putc(ch+5,fp);
i++;
}
putc(EOF,fp);
fclose(fp);
}
else
{
printf("ntTHE NEW PASSWORD DOES NOT MATCH.");
choice=1;
}

28
Password Protected Personal Diary
2013

}
}while(choice==1);
printf("nntPASSWORD CHANGED...nntPRESS ANY KEY TO GO BACK...");
getch();
}
void deleterecord( )
{
system("cls");
FILE *fp,*fptr ;
struct record file ;
char filename[15],another = 'Y' ,time[10];;
int choice,check;
printf("nntt*************************n");
printf("tt* WELCOME TO DELETE MENU*");
printf("ntt*************************nn");
check = password();
if(check==1)
{
return ;
}
while ( another == 'Y' )
{
printf("nntHOW WOULD YOU LIKE TO DELETE.");
printf("nnt#DELETE WHOLE RECORDttt[1]");
printf("nt#DELETE A PARTICULAR RECORD BY TIMEt[2]");
do
{
printf("nttENTER YOU CHOICE:");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("ntENTER THE DATE OF RECORD TO BE DELETED:[yyyy-mmdd]:");
fflush(stdin);
gets(filename);
fp = fopen (filename, "wb" ) ;
if ( fp == NULL )
{
printf("nTHE FILE DOES NOT EXISTS");

29
Password Protected Personal Diary
2013

printf("nPRESS ANY KEY TO GO BACK.");
getch();
return ;
}
fclose(fp);
remove(filename);
printf("nDELETED SUCCESFULLY...");
break;
case 2:
printf("ntENTER THE DATE OF RECORD:[yyyy-mm-dd]:");
fflush(stdin);
gets(filename);
fp = fopen (filename, "rb" ) ;
if ( fp == NULL )
{
printf("nTHE FILE DOES NOT EXISTS");
printf("nPRESS ANY KEY TO GO BACK.");
getch();
return ;
}
fptr=fopen("temp","wb");
if(fptr==NULL)
{
printf("nSYSTEM ERROR");
printf("nPRESS ANY KEY TO GO BACK");
getch();
return ;
}
printf("ntENTER THE TIME OF RECORD TO BE DELETED:[hh:mm]:");
fflush(stdin);
gets(time);
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);

30
Password Protected Personal Diary
2013

printf("nDELETED SUCCESFULLY...");
break;
default:
printf("ntYOU ENTERED WRONG CHOICE");
break;
}
}while(choice<1||choice>2);
printf("ntDO YOU LIKE TO DELETE ANOTHER RECORD.(Y/N):");
fflush(stdin);
scanf("%c",&another);
}
printf("nntPRESS ANY KEY TO EXIT...");
getch();
}

31

More Related Content

What's hot

Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in javaGoogle
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Reportstalin george
 
Project presentation on Phone Book
Project presentation on Phone BookProject presentation on Phone Book
Project presentation on Phone BookSp Gurjar
 
Result Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsResult Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsJubair Hossain
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java Ravi_Kant_Sahu
 
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEMDATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEMAYESHA JAVED
 
Phone Book project in Data Structure C
Phone  Book  project in Data Structure CPhone  Book  project in Data Structure C
Phone Book project in Data Structure CVaithekyAnandarajah
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
Event managementsystem
Event managementsystemEvent managementsystem
Event managementsystemPraveen Jha
 
Presentation on java project (bank management system)
Presentation on java project (bank management system)Presentation on java project (bank management system)
Presentation on java project (bank management system)Gopal Sheel
 
Weather app presentation
Weather app presentationWeather app presentation
Weather app presentationAshfak Mazhar
 
Java Presentation
Java PresentationJava Presentation
Java Presentationpm2214
 
ToDoList
ToDoListToDoList
ToDoListISsoft
 
Project Report on Employee Management System.docx
Project Report on Employee Management System.docxProject Report on Employee Management System.docx
Project Report on Employee Management System.docxDhineshkumarPrakasam
 
Dynamic memory allocation in c
Dynamic memory allocation in cDynamic memory allocation in c
Dynamic memory allocation in clavanya marichamy
 
Student management system
Student management systemStudent management system
Student management systemAmit Gandhi
 

What's hot (20)

Java project-presentation
Java project-presentationJava project-presentation
Java project-presentation
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in java
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Report
 
Project presentation on Phone Book
Project presentation on Phone BookProject presentation on Phone Book
Project presentation on Phone Book
 
Result Management System - CSE Final Year Projects
Result Management System - CSE Final Year ProjectsResult Management System - CSE Final Year Projects
Result Management System - CSE Final Year Projects
 
Bank Management System
Bank Management SystemBank Management System
Bank Management System
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java
 
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEMDATA PERSISTENCE IN ANDROID OPERATING SYSTEM
DATA PERSISTENCE IN ANDROID OPERATING SYSTEM
 
Phone Book project in Data Structure C
Phone  Book  project in Data Structure CPhone  Book  project in Data Structure C
Phone Book project in Data Structure C
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Event managementsystem
Event managementsystemEvent managementsystem
Event managementsystem
 
Presentation on java project (bank management system)
Presentation on java project (bank management system)Presentation on java project (bank management system)
Presentation on java project (bank management system)
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Weather app presentation
Weather app presentationWeather app presentation
Weather app presentation
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
ToDoList
ToDoListToDoList
ToDoList
 
Project Report on Employee Management System.docx
Project Report on Employee Management System.docxProject Report on Employee Management System.docx
Project Report on Employee Management System.docx
 
Dynamic memory allocation in c
Dynamic memory allocation in cDynamic memory allocation in c
Dynamic memory allocation in c
 
Student management system
Student management systemStudent management system
Student management system
 
Food donation project report I
Food donation project report IFood donation project report I
Food donation project report I
 

Viewers also liked

Srand010 personal diary
Srand010 personal diarySrand010 personal diary
Srand010 personal diaryAndroidproject
 
Personal digital diary
Personal digital diaryPersonal digital diary
Personal digital diaryisoeh
 
My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsUsman Sait
 
L6 diary management
L6   diary managementL6   diary management
L6 diary managementMrJRogers
 
Garrage management system
Garrage management system Garrage management system
Garrage management system Prateek Pandey
 
Overview of the Tanzanian dairy industry challenges and opportunities
Overview of the Tanzanian dairy industry challenges and opportunitiesOverview of the Tanzanian dairy industry challenges and opportunities
Overview of the Tanzanian dairy industry challenges and opportunitiesILRI
 
Student Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final ProjectStudent Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final ProjectHaqnawaz Ch
 
Effective Digital Diary Studies / UXPA Webinar May 2016
Effective Digital Diary Studies / UXPA Webinar May 2016Effective Digital Diary Studies / UXPA Webinar May 2016
Effective Digital Diary Studies / UXPA Webinar May 2016Sara Cambridge
 
scientific calculator using c
scientific calculator using cscientific calculator using c
scientific calculator using cAnuj Kumar
 
DS_Final_Project
DS_Final_ProjectDS_Final_Project
DS_Final_Project星星 孫
 
Hotel Management In C++
Hotel Management In C++Hotel Management In C++
Hotel Management In C++Amish Mhatre
 
Library management in Data structure
Library management in Data structure Library management in Data structure
Library management in Data structure harshil1902
 
Scientific calculator in c
Scientific calculator in cScientific calculator in c
Scientific calculator in cUpendra Sengar
 

Viewers also liked (20)

Srand010 personal diary
Srand010 personal diarySrand010 personal diary
Srand010 personal diary
 
A Personal Diary
A Personal DiaryA Personal Diary
A Personal Diary
 
Personal digital diary
Personal digital diaryPersonal digital diary
Personal digital diary
 
My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & Snapshots
 
Digital diary
Digital diaryDigital diary
Digital diary
 
L6 diary management
L6   diary managementL6   diary management
L6 diary management
 
Garrage management system
Garrage management system Garrage management system
Garrage management system
 
Project ppt
Project pptProject ppt
Project ppt
 
Overview of the Tanzanian dairy industry challenges and opportunities
Overview of the Tanzanian dairy industry challenges and opportunitiesOverview of the Tanzanian dairy industry challenges and opportunities
Overview of the Tanzanian dairy industry challenges and opportunities
 
My digital diary
My digital diaryMy digital diary
My digital diary
 
L4 proofs
L4   proofsL4   proofs
L4 proofs
 
Using A Calculator 1
Using A Calculator 1Using A Calculator 1
Using A Calculator 1
 
Student Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final ProjectStudent Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final Project
 
Effective Digital Diary Studies / UXPA Webinar May 2016
Effective Digital Diary Studies / UXPA Webinar May 2016Effective Digital Diary Studies / UXPA Webinar May 2016
Effective Digital Diary Studies / UXPA Webinar May 2016
 
scientific calculator using c
scientific calculator using cscientific calculator using c
scientific calculator using c
 
DS_Final_Project
DS_Final_ProjectDS_Final_Project
DS_Final_Project
 
Hotel Management In C++
Hotel Management In C++Hotel Management In C++
Hotel Management In C++
 
Telephone directory
Telephone directoryTelephone directory
Telephone directory
 
Library management in Data structure
Library management in Data structure Library management in Data structure
Library management in Data structure
 
Scientific calculator in c
Scientific calculator in cScientific calculator in c
Scientific calculator in c
 

Similar to Password protected personal diary report

Similar to Password protected personal diary report (20)

Design problem
Design problemDesign problem
Design problem
 
Deep Dumpster Diving
Deep Dumpster DivingDeep Dumpster Diving
Deep Dumpster Diving
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
 
Structures-2
Structures-2Structures-2
Structures-2
 
7 functions
7  functions7  functions
7 functions
 
Computerscience 12th
Computerscience 12thComputerscience 12th
Computerscience 12th
 
C programs
C programsC programs
C programs
 
L8 file
L8 fileL8 file
L8 file
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
 
Telephone directory using c language
Telephone directory using c languageTelephone directory using c language
Telephone directory using c language
 
Session 40 : SAGA Overview and Introduction
Session 40 : SAGA Overview and Introduction Session 40 : SAGA Overview and Introduction
Session 40 : SAGA Overview and Introduction
 
Functions
FunctionsFunctions
Functions
 
Fucntions & Pointers in C
Fucntions & Pointers in CFucntions & Pointers in C
Fucntions & Pointers in C
 
Projeto1617_FaseFinalMakefileall simulador monitormoni.docx
Projeto1617_FaseFinalMakefileall simulador monitormoni.docxProjeto1617_FaseFinalMakefileall simulador monitormoni.docx
Projeto1617_FaseFinalMakefileall simulador monitormoni.docx
 
Unit2 C
Unit2 C Unit2 C
Unit2 C
 
Unit2 C
Unit2 CUnit2 C
Unit2 C
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
Lab loop
Lab loopLab loop
Lab loop
 

Recently uploaded

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 

Recently uploaded (20)

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 

Password protected personal diary report

  • 1. Password Protected Personal Diary CP Project Sir Faisal Ahmed 12/21/2013
  • 2. Password Protected Personal Diary 2013 RAO MOUEED AHMED 18304(BE(EE)) MUHAMMAD YASIN KHAN (BE(EE)) th 4 Semester IQRA UNIVERSITY 2
  • 3. Password Protected Personal Diary 2013 About Program As eminent by its name that it should be an ordinary personal diary but in reality it is not. This program is very useful for many professional persons for instance; It is quite useful for doctors. Doctors can use it for taking appointments and also they can keep the record of his patients as long as he can. The travelers also use it for their purposes, what is their next plan? Where they have to go further? And also they can save their memories of the journey etc, for instances. Features of Program Following are the features of the program: The most important feature is that it is the password protected. This program is also capable of changing the password as many times as you can. This program has a capability of storing unlimited (depends on the memory) records. The user can also take a look on his records. The user can also make changes in the record. The user has a power of deleting any record. 1
  • 4. Password Protected Personal Diary 2013 Header Files Used in the Program stdio.h stdio.h is the name of the package for Standard Input / Output. This is necessary for getting input from users and outputting text to the screen. Also we use it for file handling. stdlib.h stdlib.h is the header of the general purpose standard library of C programming language which includes functions involving memory allocation, process control, conversions and others. Use For process control such as system(),exit(). Also used for defining NULL macro. Conio.h conio.h header used in c programming contains functions for console input/output. We use this header file for following functions: clrscr() clearing screen. getch() for getting character from the user. String.h C string handling refers to a group of functions implementing operations on strings in the C standard library. We use this header file for following functions: strcmp() String comparison. strcpy() copy the string. 2
  • 5. Password Protected Personal Diary 2013 Brief Description of Coding Main Function ( main( ) ) 3
  • 7. Password Protected Personal Diary 2013 Password Function This function provides the password facility. 5
  • 9. Password Protected Personal Diary 2013 Add Record Function Through this function we can add records as much as we can. 7
  • 11. Password Protected Personal Diary 2013 View Record Function This function helps in viewing records. 9
  • 13. Password Protected Personal Diary 2013 Edit Record Function This function facilitates the editing environment. 11
  • 15. Password Protected Personal Diary 2013 Edit Password Function Through this function we can edit or change the password. 13
  • 17. Password Protected Personal Diary 2013 Delete Record Function This function helps in deleting any record. 15
  • 18. Password Protected Personal Diary 2013 The Coding #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> int password(); void addrecord(); void viewrecord(); void editrecord(); void editpassword(); void deleterecord(); struct record { char time[6]; char name[30]; char place[25]; char duration[10]; char note[500]; }; int main() { clrscr(); int ch; printf("nnt***********************************n"); printf("t*PASSWORD PROTECTED PERSONAL DIARY*n"); printf("t***********************************"); while(1) { printf("nnttMAIN MENU:"); printf("nntADD RECORDt[1]"); printf("ntVIEW RECORDt[2]"); printf("ntEDIT RECORDt[3]"); printf("ntDELETE RECORDt[4]"); printf("ntEDIT PASSWORDt[5]"); printf("ntEXITtt[6]"); printf("nntENTER YOUR CHOICE:"); 16
  • 19. Password Protected Personal Diary 2013 scanf("%d",&ch); switch(ch) { case 1: addrecord(); break; case 2: viewrecord(); break; case 3: editrecord(); break; case 4: deleterecord(); break; case 5: editpassword(); break; case 6: printf("nnttTHANK YOU FOR USING THE SOFTWARE BY:RAO MOUEED AHMED"); getch(); exit(0); default: printf("nYOU ENTERED WRONG CHOICE.."); printf("nPRESS ANY KEY TO TRY AGAIN"); getch(); break; } system("cls"); } return 0; } void addrecord( ) { system("cls"); FILE *fp ; char another = 'Y' ,time[10]; struct record e ; char filename[15]; 17
  • 20. Password Protected Personal Diary 2013 int choice; printf("nntt***************************n"); printf("tt* WELCOME TO THE ADD MENU *"); printf("ntt***************************nn"); printf("nntENTER DATE OF YOUR RECORD:[yyyy-mm-dd]:"); fflush(stdin); gets(filename); fp = fopen (filename, "ab+" ) ; if ( fp == NULL ) { fp=fopen(filename,"wb+"); if(fp==NULL) { printf("nSYSTEM ERROR..."); printf("nPRESS ANY KEY TO EXIT"); getch(); return ; } } while ( another == 'Y'|| another=='y' ) { choice=0; fflush(stdin); printf ( "ntENTER TIME:[hh:mm]:"); scanf("%s",time); rewind(fp); while(fread(&e,sizeof(e),1,fp)==1) { if(strcmp(e.time,time)==0) { printf("ntTHE RECORD ALREADY EXISTS.n"); choice=1; } } if(choice==0) { strcpy(e.time,time); printf("tENTER NAME:"); fflush(stdin); gets(e.name); 18
  • 21. Password Protected Personal Diary 2013 fflush(stdin); printf("tENTER PLACE:"); gets(e.place); fflush(stdin); printf("tENTER DURATION:"); gets(e.duration); fflush(stdin); printf("tNOTE:"); gets(e.note); fwrite ( &e, sizeof ( e ), 1, fp ) ; printf("nYOUR RECORD IS ADDED...n"); } printf ( "ntADD ANOTHER RECORD...(Y/N) " ) ; fflush ( stdin ) ; another = getchar( ) ; } fclose ( fp ) ; printf("nntPRESS ANY KEY TO EXIT..."); getch(); } void viewrecord( ) { FILE *fpte ; system("cls"); struct record customer ; char time[6],choice,filename[14]; int ch; printf("nntt*******************************n"); printf("tt* HERE IS THE VIEWING MENU *"); printf("ntt*******************************nn"); choice=password(); if(choice!=0) { return ; } do { printf("ntENTER THE DATE OF RECORD TO BE VIEWED:[yyyy-mm-dd]:"); fflush(stdin); gets(filename); 19
  • 22. Password Protected Personal Diary 2013 fpte = fopen ( filename, "rb" ) ; if ( fpte == NULL ) { puts ( "nTHE RECORD DOES NOT EXIST...n" ) ; printf("PRESS ANY KEY TO EXIT..."); getch(); return ; } system("cls"); printf("ntHOW WOULD YOU LIKE TO VIEW:n"); printf("nt1.WHOLE RECORD OF THE DAY."); printf("nt2.RECORD OF FIX TIME."); printf("nttENTER YOUR CHOICE:"); scanf("%d",&ch); switch(ch) { case 1: printf("nTHE WHOLE RECORD FOR %s IS:",filename); while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 ) { printf("n"); printf("nTIME: %s",customer.time); printf("nMEETING WITH: %s",customer.name); printf("nMEETING AT: %s",customer.place); printf("nDURATION: %s",customer.duration); printf("nNOTE: %s",customer.note); printf("n"); } break; case 2: fflush(stdin); printf("nENTER TIME:[hh:mm]:"); gets(time); while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 ) { if(strcmp(customer.time,time)==0) { printf("nYOUR RECORD IS:"); printf("nTIME: %s",customer.time); printf("nMEETING WITH: %s",customer.name); 20
  • 23. Password Protected Personal Diary 2013 printf("nMEETING AT: %s",customer.place); printf("nDUARATION: %s",customer.duration); printf("nNOTE: %s",customer.note); } } break; default: printf("nYOU TYPED SOMETHING ELSE...n"); break; } printf("nnWOULD YOU LIKE TO CONTINUE VIEWING...(Y/N):"); fflush(stdin); scanf("%c",&choice); }while(choice=='Y'||choice=='y'); fclose ( fpte ) ; return ; } void editrecord() { system("cls"); FILE *fpte ; struct record customer ; char time[6],choice,filename[14]; int num,count=0; printf("nntt*******************************n"); printf("tt* WELCOME TO THE EDITING MENU *"); printf("ntt*******************************nn"); choice=password(); if(choice!=0) { return ; } do { printf("ntENTER THE DATE OF RECORD TO BE EDITED:[yyyy-mm-dd]:"); fflush(stdin); gets(filename); printf("ntENTER TIME:[hh:mm]:"); gets(time); fpte = fopen ( filename, "rb+" ) ; if ( fpte == NULL ) 21
  • 24. Password Protected Personal Diary 2013 { printf( "nRECORD DOES NOT EXISTS:" ) ; printf("nPRESS ANY KEY TO GO BACK"); getch(); return; } while ( fread ( &customer, sizeof ( customer ), 1, fpte ) == 1 ) { if(strcmp(customer.time,time)==0) { printf("nYOUR OLD RECORD WAS AS:"); printf("nTIME: %s",customer.time); printf("nMEETING WITH: %s",customer.name); printf("nMEETING AT: %s",customer.place); printf("nDURATION: %s",customer.duration); printf("nNOTE: %s",customer.note); printf("nnttWHAT WOULD YOU LIKE TO EDIT.."); printf("n1.TIME."); printf("n2.MEETING PERSON."); printf("n3.MEETING PLACE."); printf("n4.DURATION."); printf("n5.NOTE."); printf("n6.WHOLE RECORD."); printf("n7.GO BACK TO MAIN MENU."); do { printf("ntENTER YOUR CHOICE:"); fflush(stdin); scanf("%d",&num); fflush(stdin); switch(num) { case 1: printf("nENTER THE NEW DATA:"); printf("nNEW TIME:[hh:mm]:"); gets(customer.time); break; case 2: printf("nENTER THE NEW DATA:"); printf("nNEW MEETING PERSON:"); gets(customer.name); break; 22
  • 25. Password Protected Personal Diary 2013 case 3: printf("nENTER THE NEW DATA:"); printf("nNEW MEETING PLACE:"); gets(customer.place); break; case 4: printf("nENTER THE NEW DATA:"); printf("nDURATION:"); gets(customer.duration); break; case 5: printf("ENTER THE NEW DATA:"); printf("nNOTE:"); gets(customer.note); break; case 6: printf("nENTER THE NEW DATA:"); printf("nNEW TIME:[hh:mm]:"); gets(customer.time); printf("nNEW MEETING PERSON:"); gets(customer.name); printf("nNEW MEETING PLACE:"); gets(customer.place); printf("nDURATION:"); gets(customer.duration); printf("nNOTE:"); gets(customer.note); break; case 7: printf("nPRESS ANY KEY TOGOBACK...n"); getch(); return ; break; default: printf("nYOU TYPED SOMETHING ELSE...TRY AGAINn"); break; } }while(num<1||num>8); fseek(fpte,-sizeof(customer),SEEK_CUR); fwrite(&customer,sizeof(customer),1,fpte); fseek(fpte,-sizeof(customer),SEEK_CUR); fread(&customer,sizeof(customer),1,fpte); choice=5; break; } 23
  • 26. Password Protected Personal Diary 2013 } if(choice==5) { system("cls"); printf("nttEDITING COMPLETED...n"); printf("--------------------n"); printf("THE NEW RECORD IS:n"); printf("--------------------n"); printf("nTIME: %s",customer.time); printf("nMEETING WITH: %s",customer.name); printf("nMEETING AT: %s",customer.place); printf("nDURATION: %s",customer.duration); printf("nNOTE: %s",customer.note); fclose(fpte); printf("nntWOULD YOU LIKE TO EDIT ANOTHER RECORD.(Y/N)"); scanf("%c",&choice); count++; } else { printf("nTHE RECORD DOES NOT EXIST::n"); printf("nWOULD YOU LIKE TO TRY AGAIN...(Y/N)"); scanf("%c",&choice); } }while(choice=='Y'||choice=='y'); fclose ( fpte ) ; if(count==1) printf("n%d FILE IS EDITED...n",count); else if(count>1) printf("n%d FILES ARE EDITED..n",count); else printf("nNO FILES EDITED...n"); printf("tPRESS ENTER TO EXIT EDITING MENU."); getch(); } int password() { char pass[15]={0},check[15]={0},ch; FILE *fpp; int i=0,j; 24
  • 27. Password Protected Personal Diary 2013 printf("::FOR SECURITY PURPOSE::"); printf("::ONLY THREE TRIALS ARE ALLOWED::"); for(j=0;j<3;j++) { i=0; printf("nntENTER THE PASSWORD:"); pass[0]=getch(); while(pass[i]!='r') { if(pass[i]=='b') { i--; printf("b"); printf(" "); printf("b"); pass[i]=getch(); } else { printf("*"); i++; pass[i]=getch(); } } pass[i]='0'; fpp=fopen("SE","r"); if (fpp==NULL) { printf("nERROR WITH THE SYSTEM FILE...[FILE MISSING]n"); getch(); return 1; } else i=0; while(1) { ch=fgetc(fpp); if(ch==EOF) { check[i]='0'; 25
  • 28. Password Protected Personal Diary 2013 break; } check[i]=ch-5; i++; } if(strcmp(pass,check)==0) { printf("nntACCESS GRANTED...n"); return 0; } else { printf("nntWRONG PASSWORD..nntACCESS DENIED...n"); } } printf("nnt::YOU ENTERED WRONG PASSWORD::YOU ARE NOT ALLOWED TO ACCESS ANY FILE::nntPRESS ANY KEY TO GO BACK..."); getch(); return 1; } void editpassword() { system("cls"); printf("n"); char pass[15]={0},confirm[15]={0},ch; int choice,i,check; FILE *fp; fp=fopen("SE","rb"); if(fp==NULL) { fp=fopen("SE","wb"); if(fp==NULL) { printf("SYSTEM ERROR..."); getch(); return ; } fclose(fp); printf("nSYSTEM RESTORED...nYOUR PASSWORD IS 'ENTER'n PRESS ENTER TO CHANGE PASSWORDnn"); 26
  • 29. Password Protected Personal Diary 2013 getch(); } fclose(fp); check=password(); if(check==1) { return ; } do { if(check==0) { i=0; choice=0; printf("nntENTER THE NEW PASSWORD:"); fflush(stdin); pass[0]=getch(); while(pass[i]!='r') { if(pass[i]=='b') { i--; printf("b"); printf(" "); printf("b"); pass[i]=getch(); } else { printf("*"); i++; pass[i]=getch(); } } pass[i]='0'; i=0; printf("ntCONFIRM PASSWORD:"); confirm[0]=getch(); while(confirm[i]!='r') { 27
  • 30. Password Protected Personal Diary 2013 if(confirm[i]=='b') { i--; printf("b"); printf(" "); printf("b"); confirm[i]=getch(); } else { printf("*"); i++; confirm[i]=getch(); } } confirm[i]='0'; if(strcmp(pass,confirm)==0) { fp=fopen("SE","wb"); if(fp==NULL) { printf("nttSYSTEM ERROR"); getch(); return ; } i=0; while(pass[i]!='0') { ch=pass[i]; putc(ch+5,fp); i++; } putc(EOF,fp); fclose(fp); } else { printf("ntTHE NEW PASSWORD DOES NOT MATCH."); choice=1; } 28
  • 31. Password Protected Personal Diary 2013 } }while(choice==1); printf("nntPASSWORD CHANGED...nntPRESS ANY KEY TO GO BACK..."); getch(); } void deleterecord( ) { system("cls"); FILE *fp,*fptr ; struct record file ; char filename[15],another = 'Y' ,time[10];; int choice,check; printf("nntt*************************n"); printf("tt* WELCOME TO DELETE MENU*"); printf("ntt*************************nn"); check = password(); if(check==1) { return ; } while ( another == 'Y' ) { printf("nntHOW WOULD YOU LIKE TO DELETE."); printf("nnt#DELETE WHOLE RECORDttt[1]"); printf("nt#DELETE A PARTICULAR RECORD BY TIMEt[2]"); do { printf("nttENTER YOU CHOICE:"); scanf("%d",&choice); switch(choice) { case 1: printf("ntENTER THE DATE OF RECORD TO BE DELETED:[yyyy-mmdd]:"); fflush(stdin); gets(filename); fp = fopen (filename, "wb" ) ; if ( fp == NULL ) { printf("nTHE FILE DOES NOT EXISTS"); 29
  • 32. Password Protected Personal Diary 2013 printf("nPRESS ANY KEY TO GO BACK."); getch(); return ; } fclose(fp); remove(filename); printf("nDELETED SUCCESFULLY..."); break; case 2: printf("ntENTER THE DATE OF RECORD:[yyyy-mm-dd]:"); fflush(stdin); gets(filename); fp = fopen (filename, "rb" ) ; if ( fp == NULL ) { printf("nTHE FILE DOES NOT EXISTS"); printf("nPRESS ANY KEY TO GO BACK."); getch(); return ; } fptr=fopen("temp","wb"); if(fptr==NULL) { printf("nSYSTEM ERROR"); printf("nPRESS ANY KEY TO GO BACK"); getch(); return ; } printf("ntENTER THE TIME OF RECORD TO BE DELETED:[hh:mm]:"); fflush(stdin); gets(time); 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); 30
  • 33. Password Protected Personal Diary 2013 printf("nDELETED SUCCESFULLY..."); break; default: printf("ntYOU ENTERED WRONG CHOICE"); break; } }while(choice<1||choice>2); printf("ntDO YOU LIKE TO DELETE ANOTHER RECORD.(Y/N):"); fflush(stdin); scanf("%c",&another); } printf("nntPRESS ANY KEY TO EXIT..."); getch(); } 31