Pages

Friday, February 20, 2015

C Plus Plus Project : CINEMA HALL TICKETING SYSTEM

Cpp Project: CINEMA HALL TICKETING SYSTEM  

 /*******************************************  
 CINEMA HALL TICKETING SYSTEM  
 *********************************************/  
 #include<iostream>  
 #include<string.h>  
 #include<stdio.h>  
 #include<fstream>  
 #include<stdlib.h>  
 using namespace std;  
 class plan  
 {  
   private:  
    int code;  
    int ticket,c,y,am;  
    float d,k,t;  
    char date[30],id[100];  
    char time[30];  
    int keep;  
    char z[30];  
    char h[30];  
   char ch;  
   public:  
    void get(void);  
    void display(void);  
    void i_delete(void);  
    void s(void);  
 };  
 void plan::get()  
 {  
     cout<<"Enter ID no:                  \n";  
     cin>>id;  
   X:  
   cout<<"Choose from the following movies\n";  
   cout<<"\n************************************************\n";  
   cout<<"*  1.The Avengers          \n";  
   cout<<"*  2.The Wolverine          \n";  
   cout<<"*  3.World War Z            \n";  
   cout<<"*  4.Fast and Furious 6           \n";  
   cout<<"*  5.The Amazing Spiderman           \n";  
   cout<<"\n************************************************\n";  
   cout<<"\nPlease,Enter your movie code(1-5):          \n";  
   cin>>code;  
   if(code<1 || code>5){  
   cout<<"\nInvalid input \n";  
  goto X;  
   }  
   O:  
   cout<<"\nEnter your ticket category \n1.regular  300 Taka(incl. 15% VAT)\n2.Premium  350 Taka(incl. 15% VAT)\n3.3D     400 Taka(incl. 15% VAT)\n";  
   cin>>ticket;  
   if(ticket<1 || ticket>3){  
   cout<<"\nInvalid input \n";  
  goto O;  
   }  
   cout<<"\nAmount:                  \n";  
   cin>>am;  
   switch(ticket)  
   {  
     case 1:  
     k=am*300.00+am*300.00*0.15;  
     break;  
     case 2:  
     k=am*350.00+am*350.00*0.15;  
     break;  
     case 3:  
     k=am*400.00+am*400.00*0.15;  
     break;  
   }  
   cout<<"\nEnter Date:(dd-m-yyyy) \n";  
   cin>>date;  
   cout<<"\nEnter Time:(hr.minam\pm) \n";  
   cin>>time;  
   FILE *fp;  
   fp=fopen("plan.txt","a");  
   fprintf(fp,"%s %d  %d \t %d   %0.2f  %s\t%s\n",id,code,ticket,am,k,date,time);  
   fclose(fp);  
 }  
 void plan::display()  
 {  
     cout<<"**********************************************************************\n";  
     cout<<"ID CODE TICKET AMOUNT TOTAL  DATE\t\tTIME"<<endl;  
     cout<<"**********************************************************************\n\n";  
     fstream fp;  
     fp.open("plan.txt",ios::in);  
     while(fp)  
     {  
     fp.get(ch);  
     cout<<ch;  
     }  
    }  
 void plan::i_delete()  
    {  
     FILE *fp;  
     int line_num = 1;  
     int search_result = 0;  
     char temp[5000];  
     char *e;  
     char del[100],m[5000];  
     int d,i,j=0,n=0,u=0;  
     printf("Enter your delete part\n");  
     scanf("%s",del);  
     e="plan.txt";  
     fp=fopen(e,"r");  
     while(fgets(temp, 5000, fp) != NULL)  
     {  
       if((strstr(temp, del)) != NULL)  
       {  
         u++;  
       }  
       else  
       {  
         for(i=0; temp[i]!='\0'; i++)  
         {  
           m[j]=temp[i];  
           j++;  
         }  
       }  
     }  
     fclose(fp);  
     fp=fopen(e,"w");  
     for(n=0; n<j; n++)  
     {  
       if(m[n]==1)  
       {  
         fprintf(fp,"\n");  
       }  
       else  
       {  
         fprintf(fp,"%c",m[n]);  
       }  
     }  
     cout<<"\nID has been successfully deleted from the list!\n";  
     if(u==0)  
       {  
         system("cls");  
         cout<<"\nSorry,there is no item like this to delete.\nTry again!\n";  
       }  
     fclose(fp);  
    }  
 void plan::s()  
 {  
     FILE *fp;  
      char search[100];  
     int m,n;  
     char temp[5000];  
     do  
     {  
       fp=fopen("plan.txt","r");  
       n=0;  
       printf("Enter the item name you want to search!\n");  
       scanf("%s",search);  
       system("cls");  
       while(fgets(temp, 5000,fp)!=NULL)  
       {  
         if(strstr(temp,search)!=NULL)  
         {  
           cout<<"Your search result:\n\n";  
           cout<<"**********************************************************************\n";  
           cout<<"ID CODE TICKET AMOUNT TOTAL  DATE\t\tTIME"<<endl;  
           cout<<"**********************************************************************\n\n";  
           printf("%s\n",temp);  
           n++;  
         }  
       }  
       if(n==0)  
       {  
         printf("\nSorry there is no item called '%s' in the list.\nTry again!\n\n",search);  
       }break;  
     }  
     while(m!=0);  
   }  
 int main()  
 {  
   plan p;  
   int m;  
   do  
   {  
     cout<<endl<<"****************************************************"<<endl;;  
     cout<<"\n\tWELCOME TO CINEMA HALL TICKETING SYSTEM\n";  
     cout<<endl<<"****************************************************"<<endl;  
     cout<<"\nEnter The Appropriate number.\n"  
     <<"\n1.For taking information."  
     <<"\n2.For display."  
     <<"\n3.For delete."  
     <<"\n4.For search."  
     <<"\n5.Quit."  
     <<"\nWhat is your option?\n ";  
   cin>>m;  
   switch(m)  
   {  
   case 1:  
      p.get();  
    break;  
   case 2:  
    cout<<"displaying info\n";  
     p.display();  
    break;  
    case 3:  
     p.i_delete();  
    break;  
   case 4:  
     p.s();  
    break;  
   case 5:  
    break;  
   default:  
    cout<<"\nError Input .Try Again.\n";  
   }  
 }while(m!=5);  
 return 0;  
 }  



C Plus Plus Project : Car Parking

Cpp Project: Car Parking  

 //Car Parking Management  
 #include <iostream> //c++ header file  
 #include <string.h> //character of array  
 #include <fstream> //using file  
 using namespace std;  
 ofstream outfile ("parking.txt", ios::out| ios::app);  
 ifstream infile ("parking.txt", ios::in);  
 //----------------------------------------------------------------------------  
 //-----------------------------Driver Class-----------------------------------  
 class Driver  
 {  
 private:  
   char name[20];  
 public:  
   Driver();  
   Driver(char nam[20]);  
   void input_data();  
   void input_data(char nam[]);  
   void show_data();  
   char* get_name();  
   void write_file();  
 };  
 Driver::Driver()  
 {  
 }  
 Driver::Driver(char nam[])  
 {  
   strcpy(name,nam);  
 }  
 void Driver::input_data(char nam[])  
 {  
   strcpy(name,nam);  
 }  
 void Driver::input_data()  
 {  
   cout << "\n\tEnter Driver Name   : ";  
   char gr=getchar();  
   gets(name);  
 }  
 void Driver::show_data()  
 {  
   cout << "\n\tDriver Name    : " << name;  
 }  
 char* Driver::get_name()  
 {  
   return name;  
 }  
 void Driver::write_file()  
 {  
   outfile << "\n\tDriver Name    : " << name;  
 }  
 //-----------------------------------------------------------------------------  
 //--------------------------------Car class------------------------------------  
 class Car  
 {  
 private:  
   char id[20];  
   char type;  
 public:  
   Car();  
   Car(char i[],char typ);  
   void input_data();  
   void input_data(char i[],char typ);  
   void show_data();  
   char* get_id();  
   char get_type();  
   void write_file();  
 };  
 Car::Car()  
 {  
 }  
 Car::Car(char i[],char typ)  
 {  
   strcpy(id,i);  
   type=typ;  
 }  
 void Car::input_data(char i[],char typ)  
 {  
   strcpy(id,i);  
   type=typ;  
 }  
 void Car::input_data()  
 {  
   cout << "\n\tEnter Car ID      : ";  
   gets(id);  
   cout << "\n\tEnter Car type(b,s)  : ";  
   cin >> type;  
 }  
 void Car::show_data()  
 {  
   cout << "\n\tCar ID       : " << id;  
   cout << "\n\tCar type      : " << type;  
 }  
 char* Car::get_id()  
 {  
   return id;  
 }  
 char Car::get_type()  
 {  
   return type;  
 }  
 void Car::write_file()  
 {  
   outfile << "\n\tCar ID       : " << id;  
   outfile << "\n\tCar type      : " << type;  
 }  
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
 //---------------------------Parking Class-------------------------------------  
 class Parking  
 {  
 private:  
   Car cob;  
   Driver dob;  
   int hour;  
   int charge;  
   int small_charge;  
   int big_charge;  
   char pay_status;  
 public:  
   Parking();  
   void input_data();  
   void show_data();  
   void cal_charge();  
   void payment();  
   int get_hour();  
   int get_charge();  
   char get_pay_status();  
   void write_file();  
   void read_file();  
 };  
 Parking::Parking()  
 {  
   pay_status='N';  
   small_charge=50;  
   big_charge=100;  
   charge=0;  
   hour=0;  
 }  
 void Parking::input_data()  
 {  
   cout << "\n\tEnter Car info";  
   cout << "\n\t--------------------------------" << endl;  
   dob.input_data();  
   cob.input_data();  
   cout << "\n\tEnter time in hour   : ";  
   cin >> hour;  
 }  
 void Parking::show_data()  
 {  
   cout << "\n\tCar info";  
   cout << "\n\t--------------------------------" << endl;  
   dob.show_data();  
   cob.show_data();  
   cout << "\n\tTime in hour    : " << hour;  
   cout << "\n\tTotal Charge    : " << charge;  
   cout << "\n\tPayment Status   : " << pay_status;  
 }  
 int Parking::get_hour()  
 {  
   return hour;  
 }  
 int Parking::get_charge()  
 {  
   return charge;  
 }  
 char Parking::get_pay_status()  
 {  
   return pay_status;  
 }  
 void Parking::cal_charge()  
 {  
   char ch;  
   ch = cob.get_type();  
   if(ch=='b')  
   {  
     charge= hour*big_charge;  
   }  
   if(ch=='s')  
   {  
     charge= hour*small_charge;  
   }  
 }  
 void Parking::payment()  
 {  
   int t;  
   do  
   {  
     cout << "\n\tPlease Pay amount " << charge << " BDT Only : ";  
     cin >> t;  
   }while(t!=charge);  
   pay_status= 'Y';  
   cout << "\n\n\n\t\t\t\tThank You for your corporation!!!\n\n\n\n";  
 }  
 void Parking::write_file()  
 {  
   outfile << "\n\tCar info";  
   outfile << "\n\t--------------------------------" << endl;  
   dob.write_file();  
   cob.write_file();  
   outfile << "\n\tTime in hour    : " << hour;  
   outfile << "\n\tTotal Charge    : " << charge;  
   outfile << "\n\tPayment Status   : " << pay_status;  
 }  
 void Parking::read_file()  
 {  
   cout << infile.rdbuf();  
 }  
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
 //---------------------------main function-------------------------------------  
 int main()  
 {  
   Parking pob;  
   int choise;  
   while(1)  
   {  
     cout << "\n\t************************************************";  
     cout << "\n\t\t    Choose Your Option";  
     cout << "\n\t\t  1.For parking car entry Your Info";  
     cout << "\n\t\t  2.Show entry Info";  
     cout << "\n\t\t  0.EXIT!!";  
     cout << "\n\t************************************************";  
     cin >> choise;  
     switch(choise)  
     {  
     case 1:  
       pob.input_data();  
       pob.cal_charge();  
       pob.show_data();  
       cout << "\n\t--------------------------------" << endl;  
       pob.payment();  
       pob.write_file();  
       break;  
     case 2:  
       pob.read_file();  
       break;  
     }  
     if(choise==0)  
       break;  
     cout << "\n\tPress any key for menu: ";  
       }  
   return 0;  
 }  
 //*********************************  
 /*parking.text  
 Car info  
   --------------------------------  
   Driver Name    : Ramjan  
   Car ID       : 1  
   Car type      : b  
   Time in hour    : 1  
   Total Charge    : 100  
   Payment Status   : Y  
   Car info  
   --------------------------------  
   Driver Name    : Mahbub  
   Car ID       : 2  
   Car type      : s  
   Time in hour    : 2  
   Total Charge    : 100  
   Payment Status   : Y  
   Car info  
   --------------------------------  
   Driver Name    : Rahul  
   Car ID       : 3  
   Car type      : s  
   Time in hour    : 1  
   Total Charge    : 50  
   Payment Status   : Y  
   Car info  
   --------------------------------  
   Driver Name    : Ebrahim  
   Car ID       : 4  
   Car type      : b  
   Time in hour    : 5  
   Total Charge    : 500  
   Payment Status   : Y*/  
 //  ************************************  

C Plus Plus Project : Student info

Cpp Project: Student info  

 ///====================CREARED BY JAMIUL ALAM===========================  
 #include<iostream>  
 #include<stdio.h>  
 #include<string.h>  
 #include<stdlib.h>  
 #include<fstream>  
 using namespace std;  
  class student  
  {  
  public:  
    char name[50],dept[30],ch,adress[40];  
    float id;  
   public:  
     void add_new(char*);  
     void show(char*);  
     void del_item(char*);  
     void search(char*);  
    };  
   void student::add_new(char fname[20])  
   {  
    int d,t,s,i;  
    char sub[30];  
    do  
    {  
    FILE *fp;  
    fp=fopen(fname,"a");  
    fopen(fname,"a");  
    cout<<"student Name: ";  
    //cin>>name;  
    gets(name);  
    cin.get(name,20);  
    cout<<"\nGiven Id: ";  
    cin>>id;  
    cout<<"\nDepartment: ";  
    cin>>dept;  
    cout<<"\nAddress= ";  
    gets(adress);  
    cin.get(adress,20);  
    fprintf(fp,"\t%s\t\t%0.1f \t\t\t%s\t\t\t%s\n",name,id,dept,adress);  
    fclose(fp);  
    system("cls");  
    cout<<"\n1.To add student.\n\n0.To Break\n";  
    cin>>d;  
    }  
    while(d!=0);  
   }  
   void student::show(char fname[20])  
    {  
     cout<<"--------------------------------------------------------------------------------\n";  
     cout<<"\tNAME\t\tId \t\t\tDEPARTMENT\t\tADDRESS\n"<<endl;  
     fstream fp;  
     fp.open(fname,ios::in);  
     while(fp)  
     {  
     fp.get(ch);  
     cout<<ch;  
     }  
     cout<<"--------------------------------------------------------------------------------\n\n";  
    }  
    void student:: del_item(char fname[20])  
    {  
      int k;  
      do  
     {  
     FILE *fp;  
     char temd[5000],del[100],m[5000];  
     int d,i,j=0,n=0,u=0;  
     printf("Enter the name you want to delete!\n");  
     scanf("%s",del);  
     fp=fopen(fname,"r");  
     for(d=0; del[d]!='\0'; d++)  
     {  
     }  
     fp=fopen(fname,"r");  
     while(fgets(temd, 5000, fp) != NULL)  
     {  
       if((strstr(temd, del)) != NULL)  
       {  
         u++;  
       }  
       else  
       {  
         for(i=0; temd[i]!='\0'; i++)  
         {  
           m[j]=temd[i];  
           j++;  
         }  
       }  
     }  
     fclose(fp);  
     fp=fopen(fname,"w");  
     for(n=0; n<j; n++)  
     {  
       if(m[n]==1)  
       {  
         fprintf(fp,"\n");  
       }  
       else  
       {  
         fprintf(fp,"%c",m[n]);  
       }  
     }  
     cout<<"\nname has been successfully DELETE from the list!\n";  
     if(u==0)  
       {  
         system("cls");  
         cout<<"\nSorry,there is no name.\nTry again!\n";  
       }  
     fclose(fp);  
     printf("\nTo Delete another name then press 1\n\nto stop press 0 !\n");  
     cin>>k;  
     }  
     while(k!=0);  
    }  
   void student::search(char fname[20])  
   {  
     FILE *fp;  
     char search[100],temd[5000];  
     int m,n;  
     do  
     {  
       fp=fopen(fname,"r");  
       n=0;  
       printf("Enter the name you want to search!\n");  
       scanf("%s",search);  
       system("cls");  
       while(fgets(temd, 5000,fp)!=NULL)  
       {  
         if(strstr(temd,search)!=NULL)  
         {  
           cout<<"Your search result:\n\n";  
           cout<<"-----------------------------------------------------------------------------------\n";  
           cout<<"\tNAME\t\tId \t\t\tDEPARTMENT\t\tADDRESS"<<endl;  
           cout<<"-------------------------------------------------------------------------------------\n";  
           printf("%s\n",temd);  
           n++;  
         }  
       }  
       if(n==0)  
       {  
         printf("\nSorry there is no name match '%s' in the list.\nTry again!\n\n",search);  
       }  
       printf("To search another student then press 1 \n\nto stop press 0 !\n");  
       cin>>m;  
     }  
     while(m!=0);  
   }  
  int main()  
  {  
    char m[15],name[20];  
    float id,l;  
    cout<<"Create your file first"<<endl;  
    cin>>m;  
    cout<<"\n\nUser name: ";  
    gets(name);  
    cin.get(name,20);  
    cout<<"\n\npassword: ";cin>>id;  
    system("cls");  
    student obj;  
    int x;  
   do{  
     cout<<endl<<"****************************************************"<<endl;;  
     cout<<"\n\tWELCOME TO DATABASE SYSTEM \n";  
     cout<<endl<<"****************************************************"<<endl;  
     cout<<"\n YOUR OPTIONS:\n";  
     cout<<"\n\n\t1. ADD NEW:";  
     cout<<"\n\n\t2. SHOW :";  
     cout<<"\n\n\t3. DELETE :";  
     cout<<"\n\n\t4. SEARCH :";  
     cout<<"\n\n\t5. EXIT\n";  
    cin>>x;  
   switch(x)  
   {  
     case 1: obj.add_new(m);  
       break;  
     case 2:obj.show(m);  
       break;  
     case 3: obj.del_item(m);  
       break;  
     case 4: obj.search(m);  
       break;  
     case 5: break;  
   }  
   }  
   while(x!=5);  
   return 0;  
   }  

C Plus Plus Project : FOOD Corner

Cpp Project: FOOD Corner  

 #include<iostream>  
 #include<stdio.h>  
 #include<string.h>  
 #include<stdlib.h>  
 #include<fstream>  
 #include<conio.h>  
 using namespace std;  
  class food  
  {  
  public:  
    int code,cd;  
    char w,item[20];  
    float price;  
   public:  
     void add_item();  
     void menu(char*);  
     void del_item();  
     void sell();  
    }obj;  
   void food::add_item()  
   {  
    int n;  
    do  
    {  
    FILE *fp;  
    fp=fopen("pjt.txt","a");  
    cout<<"Code No.:";  
    cin>>code;  
    cout<<"Food Item:";  
    cin>>item;  
    cout<<"Price:";  
    cin>>price;  
    fprintf(fp,"%s \t\t %d \t\t %0.2f \n",item,code,price);  
    fclose(fp);  
    cout<<"Add more! (1 = Yes/0 = No)\n";  
    cin>>n;  
    }  
    while(n!=0);  
   }  
   void food::menu(char r[20])  
    {  
     cout<<"---------------------------------------------------------\n";  
     cout<<"NAME\t\tCode\t\tPRICE"<<endl;  
     cout<<"---------------------------------------------------------\n";  
     fstream fp;  
     fp.open(r,ios::in);  
     while(fp)  
     {  
     fp.get(w);  
     cout<<w;  
     }  
     cout<<"---------------------------------------------------------\n";  
    }  
    void food:: del_item()  
    {  
     FILE *fp;  
     char t[6000];  
     char del[20],m[6000];  
     int d,i,j=0,n=0;  
     printf("\nEnter the Food Item: ");  
     scanf("%s",del);  
     for(d=0; del[d]!='\0'; d++)  
     {  
     }  
     fp=fopen("pjt.txt","r");  
     while(fgets(t, 6000, fp) != NULL)  
     {  
       if((strstr(t, del)) != NULL)  
       {  
       }  
       else  
       {  
         for(i=0; t[i]!='\0'; i++)  
         {  
           m[j]=t[i];  
           j++;  
         }  
       }  
     }  
     fclose(fp);  
     fp=fopen("pjt.txt","w");  
     for(n=0; n<j; n++)  
     {  
       if(m[n]==1)  
       {  
         fprintf(fp,"\n");  
       }  
       else  
       {  
         fprintf(fp,"%c",m[n]);  
       }  
     }  
     fclose(fp);  
    }  
    void food::sell()  
   {  
     int j;  
    FILE *fp;  
     fp=fopen("pjt.txt","r");  
     do  
     {  
      cout<<"\nEnter Food Code:\n";  
      cin>>cd;  
      if(cd==code)  
     {  
      printf("%s \t\t %d \t\t %0.2f \n",item,code,price);  
     }  
     else{printf("No food available\n");  
     }  
     printf("Press 0 to quit :");  
     cin>>j;  
     if(j==0)  
       break;  
     }  
    while(fp);  
    fclose(fp);  
 }  
  int main()  
  {  
    char r[20]="pjt.txt";  
    int x;  
   do{  
     cout<<endl<<"****************************************************"<<endl;;  
     cout<<"\n\tFOOD Corner\n";  
     cout<<endl<<"****************************************************"<<endl;  
     cout<<"\nCHoose Your Option:\n";  
     cout<<"\n1. Show all food items:";  
     cout<<"\n2. Add a new item:";  
     cout<<"\n3. Delete items:";  
     cout<<"\n4. Sell Items";  
     cout<<"\n5. Quit\n";  
     cout<<"\nEnter Your Choice: ";  
    cin>>x;  
   switch(x)  
   {  
     case 1:obj.menu(r);  
       break;  
     case 2:obj.add_item();  
       break;  
     case 3: obj.del_item();  
       break;  
     case 4: obj.sell();  
     case 5:exit(0);  
   }  
   }  
   while(x!=5);  
   return 0;  
   }  



Friday, February 6, 2015

C Plus Plus Project : Data Entry

Cpp Project: Data Entry  

 #include<iostream>  
 #include<string>  
 #include<stdlib.h>  
 #include <fstream>  
 using namespace std;  
 class patient{  
 public:  
     char name1[100];  
     char name2[100];  
     int age;  
     char blood[20];  
     char date[20];  
     char *dept;  
     char *doc;  
     int a;  
     int t;  
     int dat,mon,yer;  
     double price,lab,total;  
     ofstream myfile;  
 public:  
     void input()  
     {  
         system("cls");  
         system("color D");  
         cout<<"\nENTER PATIENT 1ST NAME=";  
         cin>>name1;  
         cout<<"\nENTER PATIENT LAST NAME=";  
         cin>>name2;  
         cout<<"\nAGE=";  
         cin>>age;  
         cout<<"\nBLOOD GROUP=";  
         cin>>blood;  
         cout<<"\nDATE=";  
         cin>>dat;  
         cout<<"\nMONTH=";  
         cin>>mon;  
         cout<<"\nYEAR=";  
         cin>>yer;  
         cout<<"\n\n";  
         cout<<"\nTEST--\n\n"<<"\n";  
         cout<<"\n 1.EMERGENCY"<<"\n";  
         cout<<"\n 2.BLOOD TEST"<<"\n";  
         cout<<"\n 3.PATHOLOGY TEST"<<"\n";  
         cout<<"\n 4.URINE TEST"<<"\n";  
         cout<<"\n 5.CITY SCAN"<<"\n";  
         cout<<"\n 6.ULTRASONOGRAPHY"<<"\n";  
         cout<<"\n 7.ECG"<<"\n";  
         cout<<"\n 8.Endoscopy"<<"\n";  
         cin>>a;  
         try{  
             if(a==1)  
             {  
                 dept="EMERGENCY";  
                 doc="DR.MASSUM";  
             }  
             else if(a==2)  
             {  
                 dept="BLOOD TEST";  
                 doc="DR.RIAD";  
              }  
             else if(a==3)  
             {  
                 dept="PATHOLOGY TEST";  
                 doc="DR.RAHUL";  
             }  
             else if(a==4)  
             {  
                 dept="URINE TEST";  
                 doc="DR.MARUF";  
             }  
             else if(a==5)  
             {  
                 dept="CITY SCAN";  
                 doc="DR.AHSAN";  
             }  
             else if(a==6)  
             {  
                 dept="ULTRASONOGRAPHY";  
                 doc="DR.TUMPA";  
             }  
             else if(a==7)  
             {  
                 dept="ECG";  
                 doc="DR.SAFIUUDIN";  
             }  
             else if(a==8)  
             {  
                 dept="Endoscopy";  
                 doc="DR.ARIF";  
             }  
             else  
             {  
                 throw(a);  
             }  
         }  
         catch(int)  
         {  
             cout<<"\nWRONG INFORMATION!"<<"\n";  
             exit(1);  
         }  
     }  
     void display()  
     {  
             cout<<"\n\t\tNAME"<<"\t\tBLOOD"<<"\t\tAGE=\n\t\t";  
             for(int t=0;t<55;t++)  
             {  
               cout<<"=";  
             }  
             cout<<"\n\t\t"<<name1<<" "<<name2;  
             cout<<"\t"<<blood;  
             cout<<"\t\t"<<age;  
             cout<<"\n\t\tDate"<<"\t\tPatient Test"<<"\t\tDoctor name\n\t\t";  
             for(t=0;t<55;t++)  
             {  
             cout<<"=";  
             }  
             cout<<"\n\t\t"<<dat<<"/"<<mon<<"/"<<yer;  
             cout<<"\t"<<dept;  
             cout<<"\t\t"<<doc<<"\n\n";  
     }  
     void amount()  
     {  
         cout<<"\n\nLab Charge 200 TK"<<"\n";  
         lab=200;  
         if(a==1)  
         {  
            price=1000;  
         }  
         else if(a==2)  
         {  
            price=500;  
         }  
         else if(a==3)  
         {  
            price=1000;  
         }  
         else if(a==4)  
         {  
            price=1000;  
         }  
         else if(a==5)  
         {  
            price=5000;  
         }  
         else if(a==6)  
         {  
            price=2000;  
         }  
         else if(a==7)  
         {  
             price=4000;  
         }  
         else if(a==8)  
         {  
             price=3000;  
         }  
         else  
         {  
             cout<<"\nWRONG INFORMATION!"<<"\n";  
             exit(1);  
         }  
         total=price+lab;  
         display();  
         file_write();  
         cout<<"\nTOTAL FEES="<<total;  
     }  
     void file_write()  
     {  
         myfile.open("diagnostic center.txt", ios::app);  
         myfile<<"Lab Charge 200 TK"<<"\n";  
         myfile<<"\n\t\tNAME"<<"\t\tBLOOD"<<"\t\tAGE=\n\t\t";  
       for(int t=0;t<55;t++)  
       {  
        myfile<<"=";  
       }  
       myfile<<"\n\t\t"<<name1<<" "<<name2;  
       myfile<<"\t"<<blood;  
       myfile<<"\t\t"<<age;  
       myfile<<"\n\t\tDate"<<"\t\tPatient Test"<<"\t\tDoctor name\n\t\t";  
       for(t=0;t<55;t++)  
       {  
         myfile<<"=";  
       }  
       myfile<<"\n\t\t"<<dat<<"/"<<mon<<"/"<<yer;  
       myfile<<"\t"<<dept;  
       myfile<<"\t\t"<<doc;  
       myfile<<"\nTOTAL FEES="<<total;  
       myfile<<"\n\n\n";  
       myfile.close();  
     }  
 };  
 int main()  
 {  
     int n,i=0;  
     patient x1[100];  
     int num;  
     char ch;  
     do{  
         system("cls");  
         system("Color B");  
         cout<<"\nDATA ENTRY:";  
         cout<<"\n\n\t\tADMIT PATIENT [1]";  
         cout<<"\n\n\t\tVIEW LIST OF TESTS [2]";  
         cout<<"\n\n\t\tTOTAL AMOUNT [3]";  
         cout<<"\n\n\t\tEXIT [4]\n\t\t";  
         cin>>num;  
         switch(num)  
         {  
         case 1:  
             system("cls");  
             system("Color 1E");  
             cout<<"\nHOW MANY PATIENT=";  
             cin>>n;  
             for(i=0;i<n;i++)  
             {  
               x1[i].input();  
             }  
             cout<<"\nPLEASE PRESS ANY KEY FOR THE MAIN MENU";  
             cin>>ch;  
             break;  
         case 2:  
             system("cls");  
             system("Color 1E");  
             cout<<"\nLIST OF TESTs--";  
             for(i=0;i<n;i++)  
             {  
               x1[i].display();  
             }  
             cout<<"\nPLEASE PRESS ANY KEY FOR THE MAIN MENU";  
             cin>>ch;  
             break;  
         case 3:  
             system("cls");  
             system("Color 1E");  
             cout<<"\nTOTAL AMOUNT=";  
             for(i=0;i<n;i++)  
             {  
               x1[i].amount();  
             }  
             cout<<"\nPLEASE PRESS ANY KEY FOR THE MAIN MENU";  
             cin>>ch;  
             break;  
         case 4:  
             break;  
         }  
     }  
     while(num!=4);  
     return 0;  
 }  



Thursday, February 5, 2015

conio.h header file (password)

conio.h header file (password)

 

 

 

#include<stdio.h>
#include<conio.h>
void pass_gen(char pass[])
{
    int i=0;
    char ch;
    while(1)
    {
        ch=getch();
        if(ch==13)
        {
            break;
        }
        else
        putchar('*');
            pass[i++]=ch;
    }
    pass[i]='\0';
}
int main()
{
    char password[50];
pass_gen(password);
printf("%s",password);
return 0;
 
}