Page

Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

C Program For Employee Database Management System

#include<stdio.h>
#include<conio.h> 
#include<string.h> 
#include<graphics.h> 

struct emp
{
    char eid[30];
    char ename[30];
    char egen[10];
    char edoj[20];
    char edes[30];
    char eday[30];
    char ecom[30];
    char ebac[30];
    char eext[30];
};
void main()
{
      int gd=DETECT,gm;
      clrscr();
      initgraph(&gd,&gm,"");
      outtextxy(430,0,"");
      setcolor(RED);
      settextstyle(1,0,6);
      outtextxy(60,20,"EMPLOYEE DATABASE");
      setcolor(YELLOW);
      outtextxy(50,120,"MANAGEMENT SYSTEM");
      setcolor(WHITE);
      outtextxy(130,220,"(DAILY REPORT)");
      setcolor(LIGHTCYAN);
      settextstyle(1,0,4);
      outtextxy(50,320,"DEVELOPED BY--->>>");
      setcolor(BLUE);
      outtextxy(300,400,"R.N.Patel");
      getche();
      closegraph();
      menu();
      getche();
}
menu()
{
      int i,ch;
      clrscr();
      textcolor(GREEN);
      for(i=1;i<=79;i++)
      {
gotoxy(i,1);
printf("*");
gotoxy(i,25);
printf("*");
      }
      for(i=1;i<=24;i++)
      {
 gotoxy(1,i);
 printf("*");
 gotoxy(79,i);
 printf("*");
      }
      for(i=25;i<=55;i++)
      {
 gotoxy(i,5);
 printf("*");
 gotoxy(i,20);
 printf("*");
      }
      for(i=5;i<=20;i++)
      {
 gotoxy(25,i);
 printf("*");
 gotoxy(55,i);
 printf("*");
      }
      gotoxy(34,6);
      printf("# MAIN MENU #");
      gotoxy(30,8);
      printf("1. ADD NEW EMPLOYEE");
      gotoxy(30,10);
      printf("2. LIST OF EMPLOYEE");
      gotoxy(30,12);
      printf("3. DELETE A EMPLOYEE");
      gotoxy(30,14);
      printf("4. DAILY REPORT");
      gotoxy(30,16);
      printf("5. EXIT");
      gotoxy(28,18);
      printf("Enter Your Choice: ");
      scanf("%d",&ch);
      switch(ch)
      {
case 1:   add_emp();   break;
case 2:   list_emp();      break;
case 3:   delete_emp();    break;
case 4:   daily();   break;
case 5:   exit(0);    break;
default:
gotoxy(30,19);
   printf("WRONG CHOICE!!!");
   getch();
   clrscr();
   menu();
      }
      return;
}
add_emp()
{
      struct emp e;
      char ch;
      FILE *fp;
      clrscr();
      printf("\t\t\t# Employee Registration Form #\n\n");
      printf("Enter Employee ID: ");
      scanf("%s",e.eid);
      fflush(stdin);
      printf("Enter Employee Name: ");
      scanf("%s",e.ename);
      fflush(stdin);
      printf("Enter Employee Gender (M/F): ");
      scanf("%s",e.egen);
      fflush(stdin);
      printf("Enter Date Of Joining: ");
      scanf("%s",e.edoj);
      fflush(stdin);
      printf("Enter Employee Designation: ");
      scanf("%s",e.edes);
      fflush(stdin);
      printf("\n-------------------------------------------------------------------------");
      printf("Enter Today's Date: ");
      scanf("%s",e.eday);
      fflush(stdin);
      printf("Enter Coming Time of Employee: ");
      scanf("%s",e.ecom);
      fflush(stdin);
      printf("Enter Going Time of Employee: ");
      scanf("%s",e.ebac);
      fflush(stdin);
      printf("Enter Extra Hours of Working: ");
      scanf("%s",e.eext);
      fflush(stdin);
      printf("Do You Want to Save This Record (y/n): ");
      scanf("%c",&ch);
      if(ch=='Y'||ch=='y')
      {
    fp=fopen("EMP.TXT","ab+");
    if(fp==NULL)
    {
  printf("Error in File Opening");
  return;
    }
    fwrite(&e,sizeof(e),1,fp);
    printf("RECORD ADDED SUCCESSFULLY");
    fclose(fp);
      }
      getche();
      menu();
      return;
}
list_emp()
{
      struct emp e;
      int i=0,j=0;
      FILE *fp;
      clrscr();
      printf("\t\t\t# LIST OF EMPLOYEES #\n");
      printf("-------------------------------------------------------------------------------\n");
      printf("  ID\t\tNAME\t\tGENDER\t\tDOJ\t\tDESIGNATION\n");
      printf("-------------------------------------------------------------------------------\n");
      fp=fopen("EMP.TXT","rb");
      if(fp==NULL)
      {
printf("Error in File Opening");
return;
      }
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 i++;
      }
      if(i==1)
      {
 printf("No Record is Found");
      }
      rewind(fp);
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 printf("%s\t\t%s\t\t%s\t\t%s\t\t%s\n",e.eid,e.ename,e.egen,e.edoj,e.edes);
 j++;
 if(j==i-1)
    break;
      }
      getche();
      menu();
      return;
}
delete_emp()
{
      int i=0,j=0,k;
      struct emp e;
      char id[30];
      FILE *fp,*temp;
      clrscr();
      printf("\t\t\t # DELETION OF A EMPLOYEE #\n");
      printf("-------------------------------------------------------------------------------\n");
      printf("  ID\t\tNAME\t\tGENDER\t\tDOJ\t\tDESIGNATION\n");
      printf("-------------------------------------------------------------------------------\n");
      fp=fopen("EMP.TXT","rb");
      if(fp==NULL)
      {
printf("Error in File Opening");
return;
      }
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 i++;
      }
      rewind(fp);
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 printf("%s\t\t%s\t\t%s\t\t%s\t\t%s\n",e.eid,e.ename,e.egen,e.edoj,e.edes);
 j++;
 if(j==i-1)
    break;
      }
      printf("\n");
      printf("Enter Employee ID For Deleting: ");
      scanf("%s",id);
      rewind(fp);
      temp=fopen("EMP1.TXT","wb");
      j=0;
      k=0;
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 if(strcmp(e.eid,id)==0)
 {
    k=1;
 }
 else
 {
     fwrite(&e,sizeof(e),1,temp);
 }
 j++;
 if(j==i-1)
    break;
      }
      if(k==0)
      {
printf("No Record Found");
return;
      }
      remove("EMP.TXT");
      rename("EMP1.TXT","EMP.TXT");
      printf("Record Deleted Successfully");
      getche();
      menu();
      return;
}
daily()
{
      char id[30];
      int k=0;
      struct emp e;
      FILE *fp;
      clrscr();
      printf("Enter Employee ID for See Daily Report: ");
      scanf("%s",id);
      printf("===============================================\n");
      fp=fopen("EMP.TXT","rb");
      while(!feof(fp))
      {
 fread(&e,sizeof(e),1,fp);
 if(strcmp(e.eid,id)==0)
 {
      printf("ID: %s",e.eid);
      printf("\nName: %s",e.ename);
      printf("\nGender: %s",e.egen);
      printf("\nDate Of Joining: %s",e.edoj);
      printf("\nDesignation: %s",e.edes);
      printf("\n-------------------------------------------------------------------------");
      printf("\nToday's Date: %s",e.eday);
      printf("\nComing Time: %s",e.ecom);
      printf("\nGoing Time: %s",e.ebac);
      printf("\nExtra Hours: %s",e.eext);
      k=1;
      break;
 }
      }
      if(k==0)
printf("No Record Found");
      return;
}

How to use table for ListView layout in asp.net

<%@ Page Language="C#" AutoEventWireup="true" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<script runat="server">  
      
</script>  
<html xmlns="http://www.w3.org/1999/xhtml" >  
<head id="Head1" runat="server">  
    <title>ListView LayoutTemplate table - how to use table for ListView layout</title>  
    <style type="text/css">  
        .TableCSS  
        {  
            border-style:none;  
            background-color:SeaGreen;  
            width: 600px;  
            }  
        .TableHeader  
        {  
            background-color:MediumSeaGreen;  
            color:Snow;  
            font-size:large;  
            font-family:Verdana;  
            height:45px;  
            text-align:center;  
            }      
        .TableData  
        {  
            background-color:DarkSeaGreen;  
            color:Snow;  
            font-family:Courier New;  
            font-size:medium;  
            font-weight:bold;  
            height:30px;  
            }    
        .TablePager  
        {  
            background-color:Green;  
            height:45px;  
            }                                
        .PagerButtonCSS  
        {  
            color:DarkGreen;  
            height:35px;  
            font-weight:bold;  
            font-family:Comic Sans MS;  
            }      
        .NumericButtonCSS  
        {  
            font-size:x-large;  
            font-family:Courier New;  
            color:Snow;  
            font-family:Comic Sans MS;  
            font-weight:bold;  
            }    
        .CurrentPageLabelCSS  
        {  
            font-size:xx-large;  
            font-family:Comic Sans MS;  
            color:White;  
            font-weight:bold;  
            }   
        .NextPreviousButtonCSS  
        {  
            font-size:large;  
            font-family:Courier New;  
            color:LawnGreen;  
            font-weight:bold;  
            }                                           
    </style>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:DeepPink; font-style:italic;">ListView Example: How To Use Table Type Layout</h2>  
        <hr width="575" align="left" color="Pink" />  
        <asp:SqlDataSource   
            ID="SqlDataSource1"  
            runat="server"  
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"  
            SelectCommand="Select ProductName, UnitPrice From products Order By ProductName"  
            >  
        </asp:SqlDataSource>  
        <br />  
        <asp:ListView   
            ID="ListView1"  
            runat="server"  
            DataSourceID="SqlDataSource1"  
            >  
            <LayoutTemplate>  
                <table runat="server" class="TableCSS">  
                    <tr runat="server" class="TableHeader">  
                        <td runat="server">Product Name</td>  
                        <td runat="server">Unit Price</td>  
                    </tr>  
                    <tr id="ItemPlaceholder" runat="server">  
                    </tr>  
                    <tr runat="server" class="TablePager">  
                        <td runat="server" colspan="2">  
                            <asp:DataPager ID="DataPager1" runat="server">  
                                <Fields>  
                                    <asp:NextPreviousPagerField   
                                        ButtonType="Button"   
                                        ShowFirstPageButton="true"  
                                        ShowPreviousPageButton="false"  
                                        ShowNextPageButton="true"  
                                        ButtonCssClass="PagerButtonCSS"  
                                        />  
                                    <asp:NumericPagerField   
                                        NumericButtonCssClass="NumericButtonCSS"  
                                        NextPreviousButtonCssClass="NextPreviousButtonCSS"  
                                        CurrentPageLabelCssClass="CurrentPageLabelCSS"  
                                        />  
                                    <asp:NextPreviousPagerField   
                                        ButtonType="Button"  
                                        ShowNextPageButton="false"  
                                        ShowLastPageButton="true"  
                                        ButtonCssClass="PagerButtonCSS"  
                                        />  
                                </Fields>  
                            </asp:DataPager>  
                        </td>  
                    </tr>  
                </table>  
            </LayoutTemplate>  
            <ItemTemplate>  
                <tr class="TableData">  
                    <td>  
                        <asp:Label   
                            ID="Label1"  
                            runat="server"  
                            Text='<%# Eval("ProductName")%>'  
                            >  
                        </asp:Label>  
                    </td>  
                    <td align="center">  
                        <asp:Label   
                            ID="Label2"  
                            runat="server"  
                            Text='<%# Eval("UnitPrice")%>'  
                            >  
                        </asp:Label>  
                    </td>  
                </tr>                  
            </ItemTemplate>  
        </asp:ListView>  
    </div>  
    </form>  
</body>  
</html>  


OUTPUT



SHOPPING MALL BILLING SYSTEM IN C/C++

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<stdlib.h>
#include<ctype.h>
#include<dos.h>
#include<string.h>
#include<time.h>
#include<math.h>
struct additem
{
int item_id;
char item_name[50];
float price;
};
struct bill
{
int bill_id;
char cust_name[50];
char item_name[10][50];
float quant[10];
float total;
float price[10];
char date[15];
int n;
};
FILE *fp,*fp1,*bifp,*bifp1;
struct additem ad;
struct bill bi;
int add_item();
int generate_bill();
int delete_bill();
int display_bill();
int q=0;
void main()
{
int i=1;
textbackground(GREEN);
textcolor(BLUE);
clrscr();
textbackground(GREEN);
textcolor(BLUE);
printf("\n\n\n\n\n\n\t\t\t * * * * * * * * * * * * * *");
printf("\n\t\t\t * *");
printf("\n\t\t\t * SHOPPING *");
printf("\n\t\t\t * MALL *");
printf("\n\t\t\t * BILLING *");
printf("\n\t\t\t * SYSTEM *");
printf("\n\t\t\t * *");
printf("\n\t\t\t * * * * * * * * * * * * * *");
printf("\n\n\t\t\tPRESS 1 TO ENTER AND 0 TO EXIT.....");
scanf("%d",&i);
if(i==0)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANKS YOU");
delay(1800);
exit(0);
}
else
{
int f=1,choice;
clrscr();
/*for(f=1;f<4;f++)
{
printf("\n\nPLEASE WAIT");
printf(" .");
delay(600);
printf(" .");
delay(600);
printf(" .");
delay(600);
clrscr();
}*/
XYZ:
printf("\t\t\t ********************************\n");
printf("\t\t\t SHOPPING MALL BILLING SYSTEM\n");
printf("\t\t\t ********************************");
printf("\n--------------------------------------------------");
printf("\n\n\t1. ADD PRODUCT");
printf("\n\n\t2. GENERATE A BILL");
printf("\n\n\t3. DISPLAY A BILL");
printf("\n\n\t4. DELETE A BILL");
printf("\n\n\t5. EXIT");
printf("\n\nPRESS CORRESPONDING KEYS TO PERFORM OPERATION :- ");
ABC:
scanf("%d",&choice);
switch(choice)
{
case 1:
q=add_item();
if(q==0)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANK YOU");
delay(1800);
exit(0);
}
else
{
clrscr();
goto XYZ;
}
break;
case 2:
q=generate_bill();
if(q==0)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANK YOU");
delay(1800);
exit(0);
}
else
{
clrscr();
goto XYZ;
}
break;
case 3:
q=display_bill();
if(q==0)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANK YOU");
delay(1800);
exit(0);}
else
{
clrscr();
goto XYZ;
}
break;
case 4:
q=delete_bill();
if(q==0)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANK YOU");
delay(1800);
exit(0);
}
else
{
clrscr();
goto XYZ;
}
case 5:
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t\t THANK YOU");
delay(1800);
exit(0);
default:
printf("\n\nYOU ENTERED A WRONG VALUE.PLEASE TRY AGAIN : ");
goto ABC;
}
}
getch();
}
int add_item()
{
int f=1,id=0,p[10],i=0,h=0,t=0;
fp=fopen("product8.txt","a");
fclose(fp);
clrscr();
while(f==1)
{
clrscr();
fp=fopen("product8.txt","r");
while((fread(&ad,sizeof(ad),1,fp))==1)
{
id=ad.item_id;
}
fclose(fp);
printf("\nENTER PRODUCT NAME :-\t");
scanf("%s",ad.item_name);
//gets(ad.item_name);
printf("\nENTER PRODUCT PRICE :-\t");
scanf("%f",&ad.price);
id++;
p[i]=id;
i++;
ad.item_id=id;
fp=fopen("product8.txt","a");
fwrite(&ad,sizeof(ad),1,fp);
//printf("\nsize of ad:-%d",sizeof(ad));
fclose(fp);
printf("\n\n\n\nYOUR PRODUCT WITH ID %d IS ADDED SUCCESSFULLY....",ad.item_id);
printf("\n\nPRESS 1 TO ADD NEW PRODUCT OR ANY KEY TO EXIT...\t");
scanf("%d",&f);
if(f!=1)
{
break;
}
}
clrscr();
i=0;
fp=fopen("product8.txt","r");
while((fread(&ad,sizeof(ad),1,fp))==1)
{
if(p[i]==ad.item_id)
{
printf("\nPRODUCT ID :- %d",ad.item_id);
printf("\nPRODUCT NAME :- %s",ad.item_name);
printf("\nPRODUCT PRICE :- %f",ad.price);
printf("\n\n");
i++;
}
}
fclose(fp);
printf("PRESS 1 TO GO TO MENU PAGE AND 0 TO EXIT :-\t");
scanf("%d",&q);
return q;
}
int generate_bill()
{
time_t now;
struct tm *d;
int w=0;
int item_id,f=1,i=0,n=0,p=0,bill_id=0,k=1,j=0;
float total=0,quant=0;
bifp=fopen("bill6.txt","a");
fclose(bifp);
while(f==1)
{
int flag=0;
clrscr();
if(j==0)
{
bifp=fopen("bill6.txt","r");
while((fread(&bi,sizeof(bi),1,bifp))==1)
{
bill_id=bi.bill_id;
}
bill_id++;
bi.bill_id=bill_id;
fclose(bifp);
j++;
}
printf("\tNOTE :- JUST ENTER PRODUCT ID OF BUYING PRODUCTS TO CALCULATE BILL");
printf("\n\nPRODUCT ID :-\t");
scanf("%d",&item_id);
fp=fopen("product8.txt","r");
while((fread(&ad,sizeof(ad),1,fp))==1)
{
if(item_id==ad.item_id)
{
//printf("\nPRODUCT ID :-\t%d",ad.item_id);
printf("\n\nPRODUCT NAME :- %s",ad.item_name);
strcpy(bi.item_name[i],ad.item_name);
printf("\tPRODUCT PRICE :- %f",ad.price);
bi.price[i]=ad.price;
printf("\n\n");
flag=1;
}
}
if(flag==0)
{
printf("\n\n\tYOUR PRODUCT ID IS NOT FOUND.");
}
else
{
printf("\n\nQUANTITY OF PRODUCT :-\t");
scanf("%f",&quant);
bi.quant[i]=quant;
total=total+quant*ad.price;
bi.total=total;
flag=0;
bi.n=i;
n=i;
i++;
}
fclose(fp);
printf("\n\n\nPRESS 1 TO ADD MORE PRODUCT OTHERWISE PRESS ANY KEY TO GO TO BILL PAGE : ");
scanf("%d",&f);
}
clrscr();
printf("\n\tPUT DOWN CUSTOMER INFORMATION .....");
printf("\n\nCUSTOMER NAME :-\t");
scanf("%s",&bi.cust_name);
time(&now);
d=localtime(&now);
strftime(bi.date, 15, "%d/%m/%Y", d);
printf("\n\n\nPRESS 1 TO GENERATE A BILL AND ANY KEY TO GO TO MAIN MENU : ");
scanf("%d",&p);
if(p!=1)
{
return p;
}
else
{
i=0;
bifp=fopen("bill6.txt","a");
fwrite(&bi,sizeof(bi),1,bifp);
fclose(bifp);
clrscr();
//gotoxy(35,12);
for(p=0;p<3;p++)
{
printf("\n\nBILL IS GENERATING");
delay(500);
printf(" .");
delay(500);
printf(" .");
delay(500);
printf(" .");
delay(500);
clrscr();
}
printf("\t\t\t ********************************\n");
printf("\t\t\t SHOPPING MALL BILLING SYSTEM\n");
printf("\t\t\t ********************************");
printf("\n----------------------------------------------------");
gotoxy(2,5);
printf("CUSTOMER NAME : %s",bi.cust_name);
gotoxy(36,5);
printf("BILL ID : %d",bi.bill_id);
gotoxy(62,5);
printf("DATE : %s",bi.date);
printf("\n--------------------------------------------");
gotoxy(4,7);
printf("SrNo.");
gotoxy(12,7);
printf("ITEM NAME");
gotoxy(32,7);
printf("PRICE");
gotoxy(53,7);
printf("QUANTITY");
gotoxy(70,7);
printf("TOTAL");
total=0;
for(i=0;i<=n;i++)
{
delay(200);
gotoxy(5,w+9);
printf("%d",i+1);
gotoxy(14,w+9);
printf("%s",bi.item_name[i]);
gotoxy(31,w+9);
printf("%f",bi.price[i]);
gotoxy(53,w+9);
printf("%f",bi.quant[i]);
gotoxy(68,w+9);
printf("%f",bi.price[i]*bi.quant[i]);
total=total+(bi.price[i]*bi.quant[i]);
w=w+2;
}
delay(200);
printf("\n-----------------------------------------------------");
gotoxy(14,w+9);
printf("TOTAL");
gotoxy(66,w+9);
printf("%f Rs",total);
printf("\n-------------------------------------------------------");
delay(200);
printf("\n\nPRESS 1 TO GO TO MAIN MENU AND 0 TO EXIT :- ");
scanf("%d",&q);
return q;
}
}
int display_bill()
{
int w=0,p=0;
int item_id,f=0,i=0,bill_id=0;
float total;
clrscr();
printf("\nPLEASE ENTER YOUR BILL-ID :- ");
scanf("%d",&bill_id);
bifp=fopen("bill6.txt","a");
fclose(bifp);
bifp=fopen("bill6.txt","r");
while((fread(&bi,sizeof(bi),1,bifp))==1)
{
if(bill_id==bi.bill_id)
{
f=1;
clrscr();
for(p=0;p<3;p++)
{
printf("\n\nSEARCHING");
delay(500);
printf(" .");
delay(500);
printf(" .");
delay(500);
printf(" .");
delay(500);
clrscr();
}
printf("\t\t\t ********************************\n");
printf("\t\t\t SHOPPING MALL BILLING SYSTEM\n");
printf("\t\t\t ********************************");
printf("\n-------------------------------------------------------------");
gotoxy(2,5);
printf("CUSTOMER NAME : %s",bi.cust_name);
gotoxy(36,5);
printf("BILL ID : %d",bi.bill_id);
gotoxy(62,5);
printf("DATE : %s",bi.date);
printf("\n-----------------------------------------------------------");
gotoxy(4,7);
printf("SrNo.");
gotoxy(12,7);
printf("ITEM NAME");
gotoxy(32,7);
printf("PRICE");
gotoxy(53,7);
printf("QUANTITY");
gotoxy(70,7);
printf("TOTAL");
total=0;
for(i=0;i<=bi.n;i++)
{
delay(200);
gotoxy(5,w+9);
printf("%d",i+1);
gotoxy(14,w+9);
printf("%s",bi.item_name[i]);
gotoxy(31,w+9);
printf("%f",bi.price[i]);
gotoxy(53,w+9);
printf("%f",bi.quant[i]);
gotoxy(68,w+9);
printf("%f",bi.price[i]*bi.quant[i]);
total=total+(bi.price[i]*bi.quant[i]);
w=w+2;
}
delay(200);
printf("\n-------------------------------------------------------------");
gotoxy(14,w+9);
printf("TOTAL");
gotoxy(66,w+9);
printf("%f Rs",total);
printf("\n---------------------------------------------------");
break;
}
}
if(f==0)
{
printf("\n\nSORRY, YOUR BILL-ID DOES NOT MATCH");
}
fclose(bifp);
delay(200);
printf("\n\nPRESS 1 TO GO TO MAIN MENU AND 0 TO EXIT :- ");
scanf("%d",&q);
return q;
}
int delete_bill()
{
int item_id,f=0,i=0,bill_id=0;
clrscr();
bifp=fopen("bill6.txt","w");
fclose(bifp);
printf("\nPLEASE ENTER YOUR BILL-ID :- ");
scanf("%d",&bill_id);
bifp=fopen("bill6.txt","r");
while(fread(&bi,sizeof(bi),1,bifp)==1)
{
if(bi.bill_id==bill_id)
{
f=1;
break;
}
}
fclose(bifp);
if(f==1)
{
bifp=fopen("bill6.txt","r");
bifp1=fopen("bill7.txt","w");
while((fread(&bi,sizeof(bi),1,bifp))==1)
{
fwrite(&bi,sizeof(bi),1,bifp1);
}
//fflush(bifp);
fclose(bifp);
fclose(bifp1);
bifp=fopen("bill6.txt","w");
bifp1=fopen("bill7.txt","r");
while((fread(&bi,sizeof(bi),1,bifp1))==1)
{
if(bi.bill_id!=bill_id)
{
fwrite(&bi,sizeof(bi),1,bifp);
}
}
//fflush(bifp1);
fclose(bifp1);
fclose(bifp);
printf("\n\nYOUR BILL HAS BEEN DELETED SUCCESSFULLY.");
}
else
{
printf("\n\nSORRY, YOUR BILL-ID DOES NOT MATCH.");
}
printf("\n\nPRESS 1 TO GO TO MAIN MENU AND 0 TO EXIT :- ");
scanf("%d",&q);
return q;
}

Program Date Of Birth Counter in C/C++

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
main()
{
 clrscr();
 int d,m,y,year,month,day,i,n;
 printf("Enter how many times you want to run this program : ");
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 {
 printf("Enter the date : ");
 scanf("%d%d%d",&d,&m,&y);
 if( d>31 || m>12 || (y>1900 || y<=2000) )
 {
 printf("INVALID INPUT");
 getch();
 exit(0);
 }
 year = y-1900;
 year = year/4;
 year = year+y-1900;
 switch(m)
 {
 case 1:
 case 10:
 month = 1;
 break;
 case 2:
 case 3:
 case 11: month = 4;
break;
 case 7:
 case 4:
 month = 0;
break;
 case 5:
 month = 2;
 break;
 case 6:
 month = 5;
 break;
 case 8:
 month = 3;
 break;
 case 9:
 case 12:
 month = 6;
 break;
 }
 year = year+month;
 year = year+d;
 day = year%7;
 switch(day)
 {
 case 0:
 printf("Day was SATURDAY");
break;
 case 1:
 printf("Day was SUNDAY");
break;
 case 2:
 printf("Day was MONDAY");
break;
 case 3: printf("Day was TUESDAY");
break;
 case 4:
printf("Day was WEDNESDAY");
break;
 case 5:
printf("Day was THURSDAY");
break;
 case 6:
 printf("Day was FRIDAY");
 break;
 }
}
 getch();
 return 0;
}

Faculty Information Management System in C/C++

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
#include<dos.h>
struct address
{
 int hno;
 int streetno;
 char city[15];
 char state[15];
 char country[15];
};
struct work_details
{
 char fid[5];
 char dept[15];
 char desig[15];
 float basic;
};
struct gen_details
{
 char fid[5];
 char name[25];
 struct address present_add;
 struct address permanent_add;
};
struct payroll{
 char fid[5];
 float TA;
 float DA;
 float HRA;
 float MALL;
 float bonus;
};
void wgen_det();
void rgen_det();
void wwork_det();
void rwork_det(char id[],int len);
void menu();
FILE * fp;
void main()
{
 clrscr();
 menu();
 getch();
}
void menu()
{
 char iid[5];
 int ch;
 clrscr();
 printf("\n-----------------------------------------------------------\n");
 printf("\n-----------------FACULTY MANAGEMENT SYSTEM-----------------\n");
 printf("\n1. ADD GENERAL DETAILS OF FACULTY\n");
 printf("\n2. READ GENERAL DETAILS OF FACULTY\n");
 printf("\n3. ADD WORKING DETAILS OF FACULTY\n");
 printf("\n4. READ WORKING DETAILS OF FACULTY\n"); printf("\n5. EXIT");
 printf("\n-----------------------------------------------------------\n");
 printf("\nEnter your Choice\n");
 scanf("%d",&ch);
 printf("\n-----------------------------------------------------------\n");
 switch(ch)
 {
 case 1:
 wgen_det();
 break;
 case 2:
 rgen_det();
 break;
 case 3:
 wwork_det();
 break;
 case 4:
 printf("\nEnter the FACULTY ID no.\n");
 scanf("%s",iid);
 rwork_det(iid,5);
 break;
 default:
 printf("\nYou have Entered wrong choice");
 menu();
 }
 }
void rwork_det(char id[],int len)
{
 struct work_details work;
 long cnt=0;
 int n; fp=fopen("wrk_det.txt","r");
 fread(&work,sizeof(work)+1,1,fp);
 while(fp)
 {
 if((strcmp(work.fid,id)==0))
 {
n=1;
cnt=ftell(fp);
break;
 }
 else
 {
 n=0;
 // cnt++;
 }
 }
 if(n==0)
 {
 printf("Record Not Found");
 exit(1);
 }
 else
 {
 rewind(fp);
 fseek(fp,cnt,0);
 printf("\n-----------DETAILS OF FACULTY ID No.:- %s------------",id);
 printf("\nDEPARTMENT\t: %s",work.dept);
 printf("\nDESIGNATION\t: %s",work.desig);
 printf("\nBASIC SALARY\t: %.2f",work.basic);
 printf("\nLENGTH=%d",len);
 } fclose(fp);
}
void wwork_det()
{
 struct work_details work;
 fp=fopen("wrk_det.txt","a+");
 printf("\n----------ENTER FACULTY WORKING DETAILS----------\n");
 printf("\nEnter the Faculty Identity Number\n");
 scanf("%s",work.fid);
 printf("\nEnter the Department for this Faculty\n");
 scanf("%s",work.dept);
 printf("\nEnter the Designation for this Faculty\n");
 scanf("%s",work.desig);
 printf("\nEnter the Basic Salary of this Faculty\n");
 scanf("%.2f",&work.basic);
 fwrite(&work,sizeof(work),1,fp);
 fclose(fp);
 }
void wgen_det()
{
 struct gen_details gen;
 fp=fopen("general.txt","a+");
 printf("\n-----------------ENTER FACULTY DETAILS------------------\n");
 printf("\nEnter the Faculty Identity Number\n");
 scanf("%s",gen.fid);
 printf("\nEnter the Name of the Faculty\n");
 scanf("%s",gen.name);
 printf("\n---Enter The Present Address Details of Faculty---\n");
 printf("\nEnter the House Number\n");
 scanf("%d",&gen.present_add.hno); printf("\nEnter the Street Number\n");
 scanf("%d",&gen.present_add.streetno);
 printf("\nEnter the Name of the city\n");
 scanf("%s",gen.present_add.city);
 printf("\nEnter the Name of the State\n");
 scanf("%s",gen.present_add.state);
 printf("\nEnter the Name of the Country\n");
 scanf("%s",gen.present_add.country);
 printf("\n---Enter The Permanent Address Details of Faculty---\n");
 printf("\nEnter the House Number\n");
 scanf("%d",&gen.permanent_add.hno);
 printf("\nEnter the Street Number\n");
 scanf("%d",&gen.permanent_add.streetno);
 printf("\nEnter the Name of the city\n");
 scanf("%s",gen.permanent_add.city);
 printf("\nEnter the Name of the State\n");
 scanf("%s",gen.permanent_add.state);
 printf("\nEnter the Name of the Country\n");
 scanf("%s",gen.permanent_add.country);
 fwrite(&gen,sizeof(gen),1,fp);
 fclose(fp);
 }
void rgen_det()
{
 struct gen_details genn;
 fp=fopen("general.txt","r");
 fread(&genn,sizeof(genn)+1,1,fp);
 printf("\n--------------------DETAILS OF FACULTY---------------------\n");
 printf("\nFID\t\t :%s",genn.fid);
 printf("\nNAME\t\t :%s",genn.name);
 printf("\nPRESENT ADDRESS---\n"); printf("\nHouse No :%d",genn.present_add.hno);
 printf("\nStreet No :%d",genn.present_add.streetno);
 printf("\nCity\t\t :%s",genn.present_add.city);
 printf("\nState\t\t :%s",genn.present_add.state);
 printf("\nCountry\t\t :%s",genn.present_add.country);
 printf("\nPERMANENT ADDRESS---\n");
 printf("\nHouse No :%d",genn.permanent_add.hno);
 printf("\nStreet No :%d",genn.permanent_add.streetno);
 printf("\nCity\t\t :%s",genn.permanent_add.city);
 printf("\nState\t\t :%s",genn.permanent_add.state);
 printf("\nCountry\t\t :%s",genn.permanent_add.country);
 fclose(fp);
}

Simple Interest System Code in C/C++

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
float p,r,t,intrest;
int i,j;
clrscr();
gotoxy(10,1);
for(i=1;i<=60;i++)
{
printf("%c",205);
}
gotoxy(10,5);//line
for(i=1;i<=60;i++)
{
printf("%c",205);
}
gotoxy(30,2);
textcolor(RED);
cprintf("SIMPLE INTEREST SYSTEM");
gotoxy(39,3);
cout<<"BY";
gotoxy(35,4);
textcolor(GREEN+BLINK);
cprintf("KR KUMAWAT");
gotoxy(10,6);
cout<<"Enter The Value Of Principal:";
gotoxy(40,6);
cin>>p;
gotoxy(10,7);
cout<<"Enter Time (in Year)        :";
gotoxy(40,7);
cin>>t;
gotoxy(42,7);
cout<<"year";
gotoxy(10,8);
cout<<"Enter Rate (on Principal)  :";
gotoxy(40,8);
cin>>r;
gotoxy(20,10);//line
for(i=1;i<=40;i++)
{
printf("%c",205);
}
gotoxy(20,20);//line
for(i=1;i<=40;i++)
{
printf("%c",205);
}
gotoxy(34,11);
textcolor(WHITE+BLINK);
cprintf("TOTAL INTEREST");
delay(500);
gotoxy(20,13);
cout<<"Principal  :"<<p;
gotoxy(20,14);
cout<<"Rate       :"<<r;
gotoxy(20,15);
cout<<"Time       :"<<t<<"Year";
gotoxy(30,17);

intrest=p*r*t/100;
delay(300);
textcolor(WHITE);
cprintf("INTREST :");
gotoxy(40,17);
cout<<intrest<<"/-";
getch();

}


OUTPUT