Warm welcome to every visitors

For all nepalis
 
HomeHome  ­CalendarCalendar  ­FAQFAQ  ­SearchSearch  ­MemberlistMemberlist  ­UsergroupsUsergroups  ­RegisterRegister  ­Log inLog in  
Latest topics
» Lab 8 solutions
Wed May 27, 2009 2:42 pm by Anonymous

» Criminal management system
Wed May 27, 2009 12:03 pm by krazzy

» File related lab solutions.
Wed May 27, 2009 12:01 pm by krazzy

» Simple boot virus(win98)
Wed May 27, 2009 11:46 am by krazzy

» Slambook(Student)
Wed May 27, 2009 11:44 am by krazzy

» Snake game
Wed May 27, 2009 11:40 am by krazzy

» Password cracker
Wed May 27, 2009 11:39 am by krazzy

» Hawdare partion tool
Wed May 27, 2009 11:36 am by krazzy

» Library management system
Wed May 27, 2009 11:33 am by krazzy

Search
 
 

Display results as :
 
Rechercher Advanced Search
Poll
What should be the fees range for first year?
200000-300000
80%
 80% [ 4 ]
300000-400000
20%
 20% [ 1 ]
400000-500000
0%
 0% [ 0 ]
Total Votes : 5
Hami first year ko frees kahile ghat cha??????
Sat Mar 07, 2009 12:25 pm by krazzy
What should be the fees range for first year?
Oye fees chadi ghataunu paryooooo............
cheers

Comments: 1
First yer bata chunab kasle jitcha hola???????????
Sat Mar 07, 2009 12:14 pm by Admin
Oye chunab kahile hune chance cha hola????
Any body of you know about this???????????
First year ko fee kati hunu parcha hola?????????

Comments: 0
C programming kasto lagcha??????????????
Sat Mar 07, 2009 12:10 pm by Admin
You can get lab questions solved here................

Comments: 0
Post new topic   Reply to topicShare | 
 

 Criminal management system

View previous topic View next topic Go down 
AuthorMessage
krazzy



Posts: 11
Join date: 2009-03-06
Age: 20
Location: New baneshwor,Kathmandu

PostSubject: Criminal management system   Wed May 27, 2009 12:03 pm

#include<stdio.h>
#include<conio.h>
struct criminal
{
char name[20];
char cas[20];
int year;
}c1;
void add();
void view();
void del();
void main()
{
int n;
clrscr();
printf("\t\tWelcome to CENTER JAIL DATABASE:\n");
printf("____________________________________________________________\n");
printf("\n\t\t\tMenu\n\n");
printf("____________________________________________________________\n");
printf("\n1.Add new record.\n");
printf("2.View old record.\n");
printf("3.Delete old record.\n");
printf("____________________________________________________________\n");
printf("\nPlease enter your choice:");
scanf("%d",&n);
switch(n)
{
case 1:
add();
break;
case 2:
view();
break;
case 3:
del();
break;
default:
exit();
}
getch();
}
void add()
{
FILE *fp;
int n;
clrscr();
printf("\t\tWelcome to CDB data entery point.\n");
printf("____________________________________________________________\n");
/*printf("Enter the name of file in which data want to be stored:");
scanf("%s",name);*/
fp=fopen("CDB.bin","a");
printf("Enter the name:");
scanf("%s",c1.name);
printf("Enter the case of criminal:");
scanf("%s",c1.cas);
printf("Enter the year of inprisionment:");
scanf("%d",&c1.year);
fwrite(&c1,sizeof(struct criminal),1,fp);
fclose(fp);
printf("____________________________________________________________\n\n\n");
printf("Enter 1 to goto main menu and other to exit:\n");
scanf("%d",&n);
switch(n)
{
case 1:
main();
break;
default:
exit();
}
}
void view()
{
FILE *fp;
int n;
clrscr();
printf("\t\tWelcome to CDB viewer.\n");
printf("____________________________________________________________\n");
fp=fopen("CDB.bin","r");
printf("Name\t\t\tCase\t\tYear\n");
printf("____\t\t\t____\t\t____\n\n");
while((fread(&c1,sizeof(struct criminal),1,fp))==1)
{
printf("%s\t\t\t%s\t\t%d\n",c1.name,c1.cas,c1.year);
}
fclose(fp);
printf("____________________________________________________________\n\n\n");
printf("Enter 1 to goto main menu and other to exit:\n");
scanf("%d",&n);
switch(n)
{
case 1:
main();
break;
default:
exit();
}

}
void del()
{
FILE *fp,*fp1;
char name[20];
int n,flag=1;
clrscr();
printf("\t\tWelcome to CDB data deleting point.");
printf("____________________________________________________________\n");
fp=fopen("CDB.bin","a+");
fp1=fopen("tempCDB.bin","w");
printf("Enter the name of criminal you want to remove.");
scanf("%s",name);
while(fread(&c1,sizeof(struct criminal),1,fp)==1)
{
if(strcmp(c1.name,name)!=0)
{
fwrite(&c1,sizeof(struct criminal),1,fp1);
}
else
{
printf("The record of %s has been deleted...\n",name);
flag=0;
}
}
if (flag==1)
printf("The name entered doesn't exist.\n");
remove("CDB.bin");
rename("tempCDB.bin","CDB.bin");
fclose(fp1);
fclose(fp);
printf("____________________________________________________________\n\n\n");
printf("Enter 1 to goto main menu and other to exit:\n");
scanf("%d",&n);
switch(n)
{
case 1:
main();
break;
default:
exit();
}

}


Code:
Code:
[code]
Back to top Go down
View user profile http://www.anepali.tk
 

Criminal management system

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You can reply to topics in this forum
Warm welcome to every visitors :: C programming-
Post new topic   Reply to topic