Telephone Directory
MASTER PROGRAM
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<graphics.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<graphics.h>
#include<stdlib.h>
int gdriver=DETECT,gmode,kk,i;
#include "project\s_screen.c"
#include "project\frame.c"
#define maxdb 500
int l,n=0;
int add_count=0;
int k,p;
char id[20],passw[20],filename[32];
char number[501][20],address[501][20];
char choice;
char id_name[20],password[20];
#include "project\id_fun.c"
#include "project\main_menu.c"
void main()
{
start_screen();
vv:
initgraph(&gdriver,&gmode,"c:\\tc\\bgi ");
start();
if(choice=='0')
{
main_menu();
}
goto vv;
}
WEL COME FORM
void start_screen()
{
int i,t,k,c=6;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi ");
setbkcolor(8);
setcolor(GREEN);
settextstyle(7,HORIZ_DIR,3);
for(t=0;t<=100;t++)
{
setusercharsize(t*7, t*6, t*10, t*13);
if(t>=99)
{
setcolor(c);
c=c-1;
}
outtextxy(t,t*2,"\n WEL COME ");
for(k=0;k
{
setcolor(GREEN);
line(0,k,640,k);
line(0,480-k,640,480-k);
line(k,0,k,640);
line(640-k,0,640-k,640);
}
delay(50);
if(t<98)
{
setcolor(8);
outtextxy(t,t*2,"\n WEL COME ");
setcolor(GREEN);
}
}
delay(1000);
return;
}
USER CHOICE FORM
void start()
{
FILE *fp;
FILE *f;
v:
frame();
outtextxy(220,90,"Enter the choice");
outtextxy(225,180,"[1] - Old User");
outtextxy(225,250,"[2] - New User");
outtextxy(225,320,"[3] - for quit");
choice=getch();
if(choice=='3')
{
exit(0);
}
else if(choice=='1')
{
n=0;
while(1)
{
input();
if(choice=='q')
{
break;
}
file();
if(k==0)
{
if(p==0)
{
choice='0';
break;
}
else
{
massage_box();
outtextxy(220,183,"Password is wrong");
n=n+1;
getch();
}
}
else
{
massage_box();
outtextxy(220,183,"User name is wrong");
getch();
}
}
return;
}
else if(choice=='2')
{
while(1)
{
input();
if(choice=='q')
{
break;
}
file();
if(k==0)
{
massage_box();
outtextxy(220,183,"Plese new name enter for user");
outtextxy(220,193,"name. This name alrady choose");
outtextxy(220,203,"by any User");
getch();
}
else
{
n=1;
break;
}
}
if(n==1)
{
strcpy(filename,id_name);
strcat(filename,"total_entery");
f=fopen(filename,"w");
fprintf(f,"%d",add_count);
fclose(f);
fp=fopen(id_name,"w");
fprintf(fp," %s %s",id_name,password);
fclose(fp);
choice='0';
return;
}
}
else
{
massage_box();
outtextxy(220,183,"Error: You entered the wrong");
outtextxy(220,193," choice");
getch();
}
goto v;
}
input()
{
int li;
char ii=0,id[20],passw[20],filename[40],help='0';
FILE *f;
frame();
frame_2();
outtextxy(200,75,"<< User Login >>");
outtextxy(130,193,"Enter the id_name");
outtextxy(130,257,"Enter the password");
outtextxy(130,380,"enter blank");
gotoxy(40,13);
gets(id_name);
li=strlen(id_name);
if(li==0)
{
choice='q';
return;
}
gotoxy(40,17);
while(help!=13)
{
gotoxy(40+ii,17);
help=getch();
if(help!=13)
{
password[ii]=help;
printf("*");
}
ii=ii+1;
}
li=strlen(password);
if(li==0)
{
choice='q';
}
return;
}
file()
{
FILE *f;
f=fopen(id_name,"r");
fscanf(f," %s %s",&id,&passw);
fclose(f);
k=strcmp(id_name,id);
p=strcmp(password,passw);
return;
}
MAIN MENUFORM
#include "project\exit.c"
#include "project\data_file.c"
#include "project\add_entery.c"
#include "project\delete.c"
#include "project\display.c"
#include "project\find_address.c"
#include "project\find_number.c"
#include "project\sort.c"
#include "project\edit.c"
main_menu()
{
do
{
frame();
outtextxy(280,56,"MAIN MENU");
outtextxy(200,150,"[1] - Add Entry");
outtextxy(200,170,"[2] - Edit Entry");
outtextxy(200,190,"[3] - Delete Entry");
outtextxy(200,210,"[4] - Find Address");
outtextxy(200,230,"[5] - Find Phone Number");
outtextxy(200,250,"[6] - Display All Entries");
outtextxy(200,270,"[7] - Sort Entries");
outtextxy(200,290,"[8] - Exit");
outtextxy(100,420,"Please select an option between 1 and 8.");
choice=getch();
if(choice=='1')
{
add_entery();
}
if(choice=='2')
{
edit();
}
else if(choice=='3')
{
open_file();
delete_f();
create_file();
}
else if(choice=='4')
{
find_address();
}
else if(choice=='5')
{
find_number();
}
else if(choice=='6')
{
display();
}
else if(choice=='7')
{
sort();
create_file();
display();
}
else if(choice=='8')
{
exit_menu();
if(choice=='Y'||choice=='y')
{
break;
}
}
else
{
gotoxy(7,40);
printf("---------------------------------------------------------- ");
outtextxy(60,420,"Error: Invalid choice! select an choice between 1 and 8.");
getch();
}
}while(choice!='~');
return;
}
ADD ENTRY FORM
add_entery()
{
int j;
open_file();
for(i=add_count;i<=maxdb;i++)
{
n=0;
frame();
frame_2();
outtextxy(245,75,"<< Add Entry >>");
outtextxy(120,193,"Enter the Address");
outtextxy(120,257,"Enter the Phone number");
outtextxy(53,410,"Please add entry, Leave blank to quit from this form");
gotoxy(40,13);
gets(address[i]);
l=strlen(address[i]);
if(l==0)
{
massage_box();
outtextxy(220,183,"You choose to quit");
getch();
break;
}
gotoxy(40,17);
gets(number[i]);
l=strlen(number[i]);
if(l==0)
{
massage_box();
outtextxy(220,183,"You choose to quit");
getch();
break;
}
/*--------------------------number------------------------------------------*/
l=strlen(number[i]);
if(l<10)
{
z:
if(n>5)
{
break;
}
frame();
outtextxy(245,75,"<< Add Entry >>");
outtextxy(53,420,"Error: Lenth of Number of your Address is less then 10 charecter");
frame1();
outtextxy(53,193,"Reenter the number of this address");
outtextxy(53,257,"Reenter the Phone number is ");
gotoxy(45,13);
printf(" %s ",address[i]);
gotoxy(40,17);
gets(number[i]);
n=n+1;
}
l=strlen(number[i]);
if(l<10)
{
goto z;
}
for(j=0;10<=l&&j
{
if(number[i][j]!='1'&&number[i][j]!='2'&&number[i][j]!='3'&&number[i][j]!='4'&&number[i][j]!='5'&&number[i][j]!='6'&&number[i][j]!='7'&&number[i][j]!='8'&&number[i][j]!='9'&& number[i][j]!='0'&&number[i][j]!='-')
{
n=n+1;
if(n>5)
{
break;
}
frame();
outtextxy(245,75,"<< Add Entry >>");
outtextxy(53,400,"Error: Only use integer number and '-'. For example: 0183-2330207,");
outtextxy(53,420,"9876316206");
frame1();
outtextxy(150,193,"Address is");
gotoxy(40,13);
printf(" %s ",address[i]);
outtextxy(150,257,"Reenter the number");
gotoxy(40,17);
gets(number[i]);
l=strlen(number[i]);
j=0;
j=j-1;
}
}
if(l<10)
{
goto z;
}
for(j=0;j=10;j++)
{
if(j!=4&&number[i][j]=='-')
{
n=n+1;
if(n>5)
{
break;
}
frame();
outtextxy(245,75,"<< Add Entry >>");
outtextxy(53,400,"Error: Only use this charecter '-' on fifth loction. For example:");
outtextxy(53,420," 0183-2330207, 9876316206");
frame1();
outtextxy(150,193,"Address is");
gotoxy(40,13);
printf(" %s ",address[i]);
outtextxy(150,257,"Reenter the number");
gotoxy(40,17);
gets(number[i]);
l=strlen(number[i]);
j=0;
j=j-1;
l=strlen(number[i]);
}
}
if(l<10)
{
goto z;
}
if(n>5)
{
break;
}
}
add_count=i;
create_file();
return;
}
EDIT ENTRY FORM
edit()
{
v:
frame();
outtextxy(240,56,"<< Edit Entery >>");
outtextxy(130,180,"Press - [1] - for if you know the entery number");
outtextxy(130,210,"Press - [2] - for if you don't know the entery number");
outtextxy(130,240,"Press - [3] - for exit from edit menu");
choice=getch();
if(choice=='2')
{
display();
choice='1';
}
if(choice=='1')
{
edit_main();
}
else if(choice=='3')
{
massage_box();
outtextxy(220,213,"You want to close the edit");
outtextxy(220,223,"page Press 'Y' for yes and ");
outtextxy(220,233,"press any key for no");
choice=getch();
if(choice=='y'||choice=='Y')
{
return;
}
}
else
{
massage_box();
outtextxy(220,193,"Error: Your enter the wrong");
outtextxy(220,203,"choice.");
getch();
}
goto v;
}
edit_main()
{
int z,j;
open_file();
frame();
frame_1();
outtextxy(240,75,"<< Edit Entry >>");
outtextxy(100,193,"Enter the entry number");
gotoxy(40,13);
scanf("%d",&z);
if(z>add_count)
{
massage_box();
outtextxy(220,193,"Enter the wrong entry");
getch();
return;
}
i=z-1;
vv:
frame();
outtextxy(240,56,"<< Edit Entery >>");
outtextxy(170,180,"Press - [1] - for edit address of particular entry");
outtextxy(170,210,"Press - [2] - for edit number of particular entry");
outtextxy(170,240,"Press - [3] - for exit from this menu");
choice=getch();
if(choice=='1')
{
vt:
frame();
outtextxy(200,75,"<< Edit Entry >>");
frame_1();
outtextxy(100,193," Enter the new Address ");
outtextxy(100,257," of this Phone number ");
gotoxy(40,17);
printf(" %s",number[i]);
gotoxy(40,13);
gets(address[i]);
l=strlen(address[i]);
if(l<1)
{
outtextxy(53,420,"Error: Lenth of entry Address is less then 1 charecter");
getch();
goto vt;
}
create_file();
}
if(choice=='2')
{
vn:
frame();
outtextxy(240,75,"<< Edit Entry >>");
frame1();
outtextxy(53,193,"enter the number of this address");
outtextxy(53,257,"enter the Phone number is");
gotoxy(40,13);
printf(" %s ",address[i]);
gotoxy(40,17);
gets(number[i]);
l=strlen(number[i]);
if(l<10)
{
outtextxy(53,420,"Error: Lenth of Number of your Address is less then 10 charecter");
getch();
goto vn;
}
for(j=0;10<=l&&j
{
if(number[i][j]!='1'&&number[i][j]!='2'&&number[i][j]!='3'&&number[i][j]!='4'&&number[i][j]!='5'&&number[i][j]!='6'&&number[i][j]!='7'&&number[i][j]!='8'&&number[i][j]!='9'&& number[i][j]!='0'&&number[i][j]!='-')
{
frame();
outtextxy(240,75,"<< Edit Entery >>");
outtextxy(53,400,"Error: Only use integer number and '-'. For example: 0183-2330207,");
outtextxy(53,420,"9876316206");
getch();
choice='t';
break;
}
}
if(choice=='t')
{
goto vn;
}
for(j=0;j=10;j++)
{
if(j!=4&&number[i][j]=='-')
{
frame();
outtextxy(240,75,"<< Edit Entry >>");
outtextxy(53,400,"Error: Only use this charecter '-' on fifth loction. For example:");
outtextxy(53,420," 0183-2330207, 9876316206");
getch();
choice='w';
}
}
if(choice=='w')
{
goto vn;
}
create_file();
}
else if(choice=='3')
{
massage_box();
outtextxy(220,213,"You want to close the edit");
outtextxy(220,223,"menu page, Press 'Y' for yes");
outtextxy(220,233,"and press any key for no");
choice=getch();
if(choice=='y'||choice=='Y')
{
return;
}
}
else
{
massage_box();
outtextxy(220,193,"Error: Your enter the wrong");
outtextxy(220,203,"choice.");
}
goto vv;
}
DELETE ENTRY FORM
delete_f()
{
v:
frame();
outtextxy(240,56,"<< Delete Entry >>");
outtextxy(170,180,"Press - [1] - for delete entry help of address");
outtextxy(170,210,"Press - [2] - for delete entry help of Phone number");
outtextxy(170,240,"Press - [3] - for exit from delete menu");
choice=getch();
if(choice=='1')
{
delete_a();
}
else if(choice=='2')
{
delete_n();
}
else if(choice=='3')
{
massage_box();
outtextxy(220,213,"You want to close delete ");
outtextxy(220,223,"page, Press 'Y' for yes and ");
outtextxy(220,233,"press any key for no");
choice=getch();
if(choice=='y'||choice=='Y')
{
return;
}
}
else
{
massage_box();
outtextxy(220,193,"Error: Your enter the wrong");
outtextxy(220,203,"choice.");
getch();
}
goto v;
}
delete_n()
{
int w,s_count[500],z,k=8,t;
char f_number[20],s_number[500][20],s_address[500][20];
dn:
z=0;
frame();
frame_1();
outtextxy(200,75,"<< Delete Entry >>");
outtextxy(53,193,"Enter the Phone number, of ");
outtextxy(53,203,"the entry which do you");
outtextxy(53,213,"want to delete");
gotoxy(40,13);
gets(f_number);
t=strlen(f_number);
if(t==0)
{
massage_box();
outtextxy(220,193,"empty box");
outtextxy(220,203,"You want to delete any entry");
outtextxy(220,213,"Press 'Y' for yes and press");
outtextxy(220,223,"any key for come back to ");
outtextxy(220,233,"delete main menu");
choice=getch();
if(choice=='y'||choice=='Y')
{
goto dn;
}
else
{
return;
}
}
for(i=0;i
{
w=strcmp(f_number,number[i]);
if(w==0)
{
strcpy(s_number[z],number[i]);
strcpy(s_address[z],address[i]);
s_count[z]=i+1;
z=z+1;
}
}
if(z==0)
{
massage_box();
outtextxy(220,193,"This number is not match");
outtextxy(220,203," with any entry");
getch();
return;
}
massage_box();
gotoxy(28,16);
printf("Successful: %d entry is find",z);
getch();
frame();
gotoxy(20,5);
printf("<< Find the match entry >>");
gotoxy(10,6);
printf("Entry number Address Number");
for(i=0;i
{
gotoxy(30,k);
printf(" %s",s_address[i]);
gotoxy(50,k);
printf(" %s",s_number[i]);
gotoxy(14,k);
printf("%d",s_count[i]);
k=k+1;
if(k==40)
{
gotoxy(7,50);
printf("Press any key for see the next number");
getch();
k=10;
frame();
gotoxy(20,5);
printf("<< Find the Address of particuler Phone number >>");
gotoxy(10,6);
printf("Entry Number Address Number");
}
}
getch();
if(i==1)
{
z=s_count[z-1];
goto j;
}
frame();
frame_1();
outtextxy(200,75,"<< Delete Entry >>");
outtextxy(100,193,"Enter the entry number");
gotoxy(40,13);
scanf("%d",&z);
if(z>add_count)
{
massage_box();
outtextxy(220,193,"Enter the wrong entry");
getch();
return;
}
j:
z=z-1;
massage_box();
outtextxy(220,193,"Do you want to delete this");
outtextxy(220,203,"entry. Press 'Y' for yes");
outtextxy(220,213,"and press any key for come");
outtextxy(220,223,"back to delete main menu");
choice=getch();
if(choice!='y'&&choice!='Y')
{
return;
}
add_count=add_count-1;
for(i=z;i
{
strcpy(number[i],number[i+1]);
strcpy(address[i],address[i+1]);
}
return;
}
delete_a()
{
int w,s_count[500],z,k=8,t;
char f_address[20],s_number[500][20],s_address[500][20];
da:
z=0;
frame();
frame_1();
outtextxy(200,75,"<< Delete Entry >>");
outtextxy(53,193,"Enter the Address, of the ");
outtextxy(53,203,"entry which do you want");
outtextxy(53,213,"to delete");
gotoxy(40,13);
gets(f_address);
t=strlen(f_address);
if(t==0)
{
massage_box();
outtextxy(220,193,"empty box");
outtextxy(220,203,"You want to delete any entry");
outtextxy(220,213,"Press 'Y' for yes and press");
outtextxy(220,223,"any key for come back to");
outtextxy(220,233," delete main menu");
choice=getch();
if(choice=='y'||choice=='Y')
{
goto da;
}
else
{
return;
}
}
for(i=0;i
{
w=strcmp(f_address,address[i]);
if(w==0)
{
strcpy(s_number[z],number[i]);
strcpy(s_address[z],address[i]);
s_count[z]=i+1;
z=z+1;
}
}
if(z==0)
{
massage_box();
outtextxy(220,193,"This Address is not match any");
outtextxy(220,203,"entery");
getch();
return;
}
frame();
gotoxy(20,5);
printf("<< Find the particuler entery >>");
gotoxy(10,6);
printf("Entry number Address Number");
for(i=0;i
{
gotoxy(30,k);
printf(" %s",s_address[i]);
gotoxy(50,k);
printf(" %s",s_number[i]);
gotoxy(14,k);
printf("%d",s_count[i]);
k=k+1;
if(k==40)
{
gotoxy(7,45);
printf("Press any key for see the next number");
getch();
k=10;
frame();
gotoxy(20,5);
printf("<< Find the Phone number of particuler Address >>");
gotoxy(10,6);
printf(" Entery Number Address Number");
}
}
getch();
if(i==1)
{
z=s_count[z-1];
goto j;
}
frame();
frame_1();
outtextxy(200,75,"<< Delete Entry >>");
outtextxy(100,193,"Enter the entry number");
gotoxy(40,13);
scanf("%d",&z);
if(z>add_count)
{
massage_box();
outtextxy(220,193,"Enter the wrong entry");
getch();
return;
}
j:
z=z-1;
massage_box();
outtextxy(220,193,"Do you want to delete this");
outtextxy(220,203,"entry. Press 'Y' for yes");
outtextxy(220,213,"and press any key for come");
outtextxy(220,223,"back to delete main menu");
choice=getch();
if(choice!='y'&&choice!='Y')
{
return;
}
add_count=add_count-1;
for(i=z;i
{
strcpy(number[i],number[i+1]);
strcpy(address[i],address[i+1]);
}
return;
}
FIND ENTRY ADDRESS FORM
find_address()
{
int w,t,s_count[500],z=0,k=10;
char f_number[20],s_number[500][20],s_address[500][20];
open_file();
fa:
frame();
frame_1();
outtextxy(100,75,"<< Find the Address of particuler Phone number >>");
outtextxy(53,193,"Enter the Phone number,of the ");
outtextxy(53,203,"entry which do you want to");
outtextxy(53,213,"find the address");
outtextxy(53,400,"Please add entery, Leave blank to quit from this form");
gotoxy(40,13);
gets(f_number);
t=strlen(f_number);
if(t==0)
{
massage_box();
outtextxy(220,193,"empty box");
outtextxy(220,203,"You want to find any entry");
outtextxy(220,213,"Press 'Y' for yes and press");
outtextxy(220,223,"any key for come back to ");
outtextxy(220,233,"main menu");
choice=getch();
if(choice=='y'||choice=='Y')
{
goto fa;
}
else
{
return;
}
}
for(i=0;i
{
w=strcmp(f_number,number[i]);
if(w==0)
{
strcpy(s_number[z],number[i]);
strcpy(s_address[z],address[i]);
s_count[z]=i+1;
z=z+1;
}
}
if(z==0)
{
massage_box();
outtextxy(220,193,"This number is not match");
outtextxy(220,203,"with entery");
getch();
goto fa;
}
frame();
gotoxy(20,5);
printf("<< Find the match entry >>");
gotoxy(10,6);
printf("Entry number Address Number");
for(i=0;i
{
gotoxy(30,k);
printf(" %s",s_address[i]);
gotoxy(50,k);
printf(" %s",s_number[i]);
gotoxy(14,k);
printf("%d",s_count[i]);
k=k+1;
if(k==40)
{
gotoxy(7,50);
printf("Press any key for see the next number");
getch();
k=10;
frame();
gotoxy(20,5);
printf("<< Find the Address of particuler Phone number >>");
gotoxy(10,6);
printf("Entry Number Address Number");
}
}
getch();
goto fa;
}
FIND PHONE NUMBER FORM
find_number()
{
int w,t,s_count[500],z=0,k=10;
char f_address[20],s_number[500][20],s_address[500][20];
open_file();
fn:
frame();
frame_1();
outtextxy(100,75,"<< Find the Phone number of particuler Address >>");
outtextxy(53,193,"Enter the address, ofthe entry");
outtextxy(53,203,"which do you want to find the");
outtextxy(53,213,"Phone number");
outtextxy(53,400,"Please add entery, Leave blank to quit from this form");
gotoxy(40,13);
gets(f_address);
t=strlen(f_address);
if(t==0)
{
massage_box();
outtextxy(220,193,"empty box");
outtextxy(220,203,"You want to find any entry");
outtextxy(220,213,"Press 'Y' for yes and press");
outtextxy(220,223,"any key for come back to");
outtextxy(220,233,"delete main menu");
choice=getch();
if(choice=='y'||choice=='Y')
{
goto fn;
}
else
{
return;
}
}
for(i=0;i
{
w=strcmp(f_address,address[i]);
if(w==0)
{
strcpy(s_number[z],number[i]);
strcpy(s_address[z],address[i]);
s_count[z]=i+1;
z=z+1;
}
}
if(z==0)
{
massage_box();
outtextxy(220,193,"This Address is not match ");
outtextxy(220,203,"with any entry");
getch();
goto fn;
}
massage_box();
gotoxy(28,16);
printf("Successful: %d entry is find",z);
getch();
frame();
gotoxy(20,5);
printf("<< Find the particuler entry >>");
gotoxy(10,6);
printf("Entry number Address Number");
for(i=0;i
{
gotoxy(30,k);
printf(" %s",s_address[i]);
gotoxy(50,k);
printf(" %s",s_number[i]);
gotoxy(14,k);
printf("%d",s_count[i]);
k=k+1;
if(k==40)
{
gotoxy(7,45);
printf("Press any key for see the next number");
getch();
k=10;
frame();
gotoxy(20,5);
printf("<< Find the Phone number of particuler Address >>");
gotoxy(10,6);
printf(" Entry Number Address Number");
}
}
getch();
goto fn;
}
DISPLAY AL ENTRIES FORM
display()
{
int k=8;
frame();
open_file();
gotoxy(10,6);
printf("Entry number Address Number");
for(i=0;i
{
gotoxy(14,k);
printf("%d",i+1);
gotoxy(29,k);
printf(" %s",address[i]);
gotoxy(50,k);
printf(" %s",number[i]);
k=k+1;
delay(1000);
if(k==24)
{
gotoxy(1,50);
printf("Press any key for see the next number");
getch();
k=8;
frame();
}
}
getch();
return;
}
SORT ENTRY FORM
sort()
{
int w,t_number[20],t_address[20];
open_file();
z:
frame();
outtextxy(240,56,"<< Sort Entry >>");
outtextxy(170,180,"Press - [1] - for sort entry in ascending order");
outtextxy(170,210,"Press - [2] - for sort entery in descending order");
choice=getch();
if(choice=='1')
{
for(p=0;p<(add_count-1);p++)
{
for(i=0;i<(add_count-(p+1));i++)
{
w=strcmp( address[i],address[i+1]);
if(w>0)
{
strcpy(t_address,address[i]);
strcpy(address[i],address[i+1]);
strcpy(address[i+1],t_address);
strcpy(t_number,number[i]);
strcpy(number[i],number[i+1]);
strcpy(number[i+1],t_number);
}
}
}
//create_file();
//display();
return;
}
if(choice=='2')
{
for(p=0;p<(add_count-1);p++)
{
for(i=0;i<(add_count-(p+1));i++)
{
w=strcmp( address[i],address[i+1]);
if(w<0)
{
strcpy(t_address,address[i]);
strcpy(address[i],address[i+1]);
strcpy(address[i+1],t_address);
strcpy(t_number,number[i]);
strcpy(number[i],number[i+1]);
strcpy(number[i+1],t_number);
}
}
}
//create_file();
//display();
return;
}
else
{
massage_box();
outtextxy(220,193,"Error: Your enter the wrong");
outtextxy(220,203,"choice.");
getch();
goto z;
}
}
EXIT FORM
void exit_menu()
{
massage_box();
outtextxy(220,183,"Do you really want to exit?");
outtextxy(220,193,"Press 'Y' to confirm,");
outtextxy(220,203,"any key to cancel");
choice=getch();
if(choice=='Y'||choice=='y')
{
frame();
gotoxy(27,15);
printf(">> Exit to system <<");
getch();
frame();
gotoxy(23,13);
printf("Thank you for using this project");
gotoxy(23,17);
printf("Coded by: Randeep singh Jhand ");
gotoxy(23,20);
printf("E-mail: randeep_best@yahoo.com");
getch();
//exit(0);
}
return;
}
CODING OF DATA FILES
void create_file()
{
char filename[32];
FILE *f;
strcpy(filename,id_name);
strcat(filename,"total_entry");
f=fopen(filename,"w");
fprintf(f,"%d",add_count);
fclose(f);
strcpy(filename,id_name);
strcat(filename,"phone_book");
f=fopen(filename,"w");
for(i=0;i
{
fprintf(f," %s %s",number[i],address[i]);
}
fclose(f);
return;
}
void open_file()
{
char filename[32];
FILE *f;
strcpy(filename,id_name);
strcat(filename,"total_entery");
f=fopen(filename,"r");
fscanf(f,"%d",&add_count);
fclose(f);
strcpy(filename,id_name);
strcat(filename,"phone_book");
f=fopen(filename,"r");
for(i=0;i
{
fscanf(f," %s %s",&number[i],&address[i]);
}
fclose(f);
return;
}
CODING OF FRAME
void frame()
{
cleardevice();
setbkcolor(6);
for(kk=0;kk<=51;kk++)
{
setcolor(GREEN);
if(kk>15&&kk<36)
{
line(0,kk,220,kk);
line(420,kk,640,kk);
}
else
{
line(0,kk,640,kk);
}
line(0,480-kk,640,480-kk);
line(kk,0,kk,640);
line(640-kk,0,640-kk,640);
}
setcolor(1);
outtextxy(280,23,"PHONE BOOK");
return;
}
frame_1()
{
setcolor(11);
for(kk=0;kk<25;kk++)
{
line(300,189+kk,450,189+kk);
}
setcolor(1);
return;
}
frame_2()
{
setcolor(11);
for(kk=0;kk<25;kk++)
{
line(300,189+kk,450,189+kk);
line(300,253+kk,450,253+kk);
}
setcolor(1);
return;
}
frame1()
{
setcolor(11);
for(kk=0;kk<25;kk++)
{
line(300,253+kk,450,253+kk);
}
setcolor(1);
return;
}
massage_box()
{
setcolor(4);
for(kk=0;kk<100;kk++)
{
line(200,180+kk,450,180+kk);
}
setcolor(2);
return;
}
HTML Comment Box is loading comments...
1 comment:
hi, new to the site, thanks.
Post a Comment