Password Security sederhana dengan C++

User dapat memasukkan password nya pada program ini.
Apabila password yang dimasukkan benar, akan muncul output message bahwa password benar.
Apabila password yang dimasukkan salah, akan muncul output message bahwa password salah.

*NOTE*
Password = program

Berikut adalah contoh outputnya

Apabila password salah

Apabila password benar


Berikut adalah source code C++ nya
 //Password.cpp  
 //Auther  : oursharingciub  
 //Date   : September 26, 2014 Firday  
 //Email  : oursharingclub@163.com  
 //Tool   : Dev C++  
 //Language : C++  
 //Notice: Reference Mr. Jake Rodriguez Pomperada programming  
 #include <iostream>  
 #include <conio.h>  
 #include <string>  
 #include <windows.h>  //system(), Sleep( )  
 #include <time.h>  
 using namespace std;  
 const int PASSLEN= 7 ; //The length of password  
 string PassGet( void ); // Get the password  
 void Menu( void );  //The start menu  
 //******** main function **********  
 int main( void )  
 {  
      Menu();  
      getch(); //wait untill enter any key  
      return 0;  
 }  
 //****** PassGet and menu function*****  
 string PassGet( void )  
 {  
      char password[ PASSLEN ]= { '\0' };  
      char letter;  
      int loop;  
      int len;   
      string password2;  
      len= 0;  
      loop= 0;  
      letter= '\0';  
      while( letter!= '\r' )  //Caarrige return character  
      {  
        letter= getch();  
           if( letter== '\b' && password[ 0 ]== '\0' )  
           {  
             loop= 0;  
             len= 0;  
           }  
           else  
           {  
                if( letter== '\b' && password[ 0 ]!= '\0' ) // \b :backspace  
                {  
                  cout<< "\b";  
                  cout<< " ";  
                  cout<< "\b";  
                  loop--;  
                  password[ loop ]= '\0';  
                  len-- ;  
                }  
                else  
                {  
                  if( isprint( letter )!= 0 && loop< PASSLEN )  
                     {  
                    password[ loop ]= tolower( letter );  
                    cout<< "*";  
                     }       
                     loop++;  
                     if( loop<= PASSLEN )  
                     {  
                       len++;       
                     }  
                }       
           }  
      }  
      //Convert Password from character  
      loop= 0;  
      password2= "";  
      while( loop< len )  
      {  
        password2= password2+ password[ loop ];  
           loop++;       
      }  
      return password2;   
 } //End of Passget function  
 void Menu( void )  
 {  
      string password;  
      //Get local time  
      time_t date;  
      date= time( NULL );  
      cout<< "\n\n";  
      char str[]= "********* PASSWORD SECURITY VERSION 2.0 **********";  
      for( int i= 0; i< strlen( str ); i++ )  
      {  
           cout<< str[ i ];  
           Sleep( 100 ); //wait 0.1 second  
      }  
      cout<< "\n\n";  
      cout<< "\n\t\t Notice: Protect your Password.";  
      cout<< "\n\n\t\t Enter Your Password: ";  
      password= PassGet();  
      if( password== "program" )  
      {  
           system( "cls" );  
        cout<< "\n\n\n\n";  
           cout<< "\t\t Password Accepted.";  
           cout<< "\n";  
           cout<< "\n\n\t\t Thank You For Using this Software.";  
           cout<< "\n\n\t\t Date : "<< ctime( &date );       //show local time  
      }  
      else  
      {  
        cout<< "\n\n";  
        cout<< "\n\t\tSorry...";  
        cout<< "\n\t\tPassword Denied!!!\n\n";  
        Sleep( 1000 );  
        cout<< "\n\n\t\tTry Again( Y ): ";  
        char ch;  
        cin>> ch;  
        if( toupper( ch )== 'Y' )  
        {  
                system( "cls" );  
             Menu();  
        }  
        else  
        {  
             exit( 1 );       
        }  
      }  
      return ;  
 }  //End of Menu Function  

Student Information Sederhana menggunakan C++

Pada source code dibawah, ada 3 hal yang dapat user lakukan:
1. Membuat record baru suatu murid
2. Mengubah data record suatu murid
3. Menampilkan semua record data murid

Berikut adalah contoh tampilan output nya



Berikut adalah source code C++ untuk Student Information System diatas
 #include<iostream.>  
 #include<conio.h>  
 using namespace std;  
 class aaa  
 {  
      protected:  
           int rno;  
           char fname[10],lname[10],cource[20],dob[15],mo[15],addr[20],city[10],email[30];  
           int sub1;  
           int sub2;  
           int sub3;  
           int sub4;  
           int total;  
           float per;  
           public:  
                void input_details()  
                {  
                     cout<<"\n\n Enter Roll No ===>";  
                     cin>>rno;  
                     cout<<"\n";  
                     cout<<"\n\n Enter First Name ===>";  
                     cin>>fname;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Last Name ===>";  
                     cin>>lname;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Cource ===>";  
                     cin>>cource;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Date Of Birth ===>";  
                     cin>>dob;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Mobile No ===>";  
                     cin>>mo;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Address ===>";  
                     cin>>addr;  
                     cout<<"\n";  
                     cout<<"\n\n Enter City ===>";  
                     cin>>city;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Email ===>";  
                     cin>>email;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Mark Of DS ===>";  
                     cin>>sub1;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Mark Of VB ===>";  
                     cin>>sub2;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Mark Of OS ===>";  
                     cin>>sub3;  
                     cout<<"\n";  
                     cout<<"\n\n Enter Mark Of SAD ===>";  
                     cin>>sub4;  
                     cout<<"\n";  
                     total = sub1+sub2+sub3+sub4;  
                     per=total/4;  
                }  
                void output_details()  
                {  
                     cout<<"\n\t\t Roll No    :---> "<<rno;  
                     cout<<"\n\t\t First Name  :---> "<<fname;  
                     cout<<"\n\t\t Last Name   :---> "<<lname;  
                     cout<<"\n\t\t cource    :---> "<<cource;  
                     cout<<"\n\t\t Date Of Birth :---> "<<dob;  
                     cout<<"\n\t\t Mobile No   :---> "<<mo;  
                     cout<<"\n\t\t Address    :---> "<<addr;  
                     cout<<"\n\t\t City     :---> "<<city;  
                     cout<<"\n\t\t Email     :---> "<<email;  
                }  
                void output_marksheet()  
                {  
                     cout<<"\n\t\t Marks OF DS  :---> "<<sub1;  
                     cout<<"\n\t\t Marks OF VB  :---> "<<sub2;  
                     cout<<"\n\t\t Marks OF OS  :---> "<<sub3;  
                     cout<<"\n\t\t Marks OF SAD :---> "<<sub4;  
                     cout<<"\n\t\t Total Marks  :---> "<<total;  
                     cout<<"\n\t\t Percentage  :---> "<<per;  
                          if(per>=90 && per<=100)  
                     {  
                          cout<<"\n\n\t\t Your Grade is :----> A+";  
                          cout<<"\n";  
                     }  
                     else if(per>=80 && per<=90)  
                     {  
                          cout<<"\n\n\t\t Your Grade is :----> A";  
                          cout<<"\n";  
                     }  
                     else if(per>=70 && per<=80)  
                     {  
                          cout<<"\n\t\t Your Grade is :----> B+";  
                     }  
                     else if(per>=60 && per<=70)  
                     {  
                          cout<<"\n\t\t Your Grade is :----> B";  
                     }  
                     else if(per>=50 && per<=60)  
                     {  
                          cout<<"\n\t\t Your Grad is :----> C";  
                     }  
                     else if(per>=40 && per<=50)  
                     {  
                          cout<<"\n\t\t Your Grad is :---->D";  
                     }  
                     else  
                     {  
                          cout<<"\n\t\t You Are Fail......";  
                     }  
                }  
 };  
 class master : virtual public aaa  
 {  
      public:  
           void create()  
           {  
                cout<<"\n\n\t=========================> Insert Information <========================\n\n";  
                input_details();  
           }  
           void display()  
           {  
                cout<<"\n\n\t=========================> Summary Report <============================\n\n";  
                output_details();  
                cout<<"\n\n\t=========================> Marksheet Report <==========================\n\n";  
                output_marksheet();  
                cout<<"\n\n\t=========================> End Of Marksheet <==========================\n\n";  
                cout<<"\n\n\t=========================> End of Report <=============================\n\n";  
           }  
           void update()  
           {  
                int choice;  
                cout<<"\n\n\t=========================> Update Information <=========================\n\n";  
                cout<<"\n\n\t ---------------> choose Details You Want to Perform <--------------\n\n";  
                cout<<"\n\n Roll No ===>"<<rno<<"\n";  
                cout<<"\n\n First Name ===>"<<fname<<"\n";  
                cout<<"\n\n Last Name ====>"<<lname<<"\n";  
                cout<<"\n\n Cource ===>"<<cource<<"\n";  
                cout<<"\n\n Date Of Birth ===>"<<dob<<"\n";  
                cout<<"\n\n Mobile No ===>"<<mo<<"\n";  
                cout<<"\n\n Address ===>"<<addr<<"\n";  
                cout<<"\n\n City ===>"<<city<<"\n";  
                cout<<"\n\n Email ===>"<<email<<"\n";  
                cout<<"\n\n DS Marks ===>"<<sub1<<"\n";  
                cout<<"\n\n VB Marks ===>"<<sub2<<"\n";  
                cout<<"\n\n OS Marks ===>"<<sub3<<"\n";  
                cout<<"\n\n SAD Marks ===>"<<sub4<<"\n";  
                cout<<"\n\n Enter Your Choice ====>";  
                cin>>choice;  
                switch(choice)  
                {  
                     case 1:  
                          cout<<"\n\n Enter Roll No :--->";  
                          cin>>rno;  
                          cout<<"\n";  
                          break;  
                     case 2:  
                          cout<<"\n\n Enter First Name :--->";  
                          cin>>fname;  
                          cout<<"\n";  
                          break;  
                     case 3:  
                          cout<<"\n\n Enter Last Name :--->";  
                          cin>>lname;  
                          cout<<"\n";  
                          break;  
                     case 4:  
                          cout<<"\n\n Enter Cource :--->";  
                          cin>>cource;  
                          cout<<"\n";  
                          break;  
                     case 5:  
                          cout<<"\n\n Enter Date Of Birth :--->";  
                          cin>>dob;  
                          cout<<"\n";  
                          break;  
                     case 6:  
                          cout<<"\n\n Enter Mobile No :--->";  
                          cin>>mo;  
                          cout<<"\n";  
                          break;  
                     case 7:  
                          cout<<"\n\n Enter Address :--->";  
                          cin>>addr;  
                          cout<<"\n";  
                          break;  
                     case 8:  
                          cout<<"\n\n Enter city :--->";  
                          cin>>city;  
                          cout<<"\n";  
                          break;  
                     case 9:  
                          cout<<"\n\n Enter Email :--->";  
                          cin>>email;  
                          break;  
                     case 10:  
                          cout<<"\n\n Enter Marks Of DS :--->";  
                          cin>>sub1;  
                          break;  
                     case 11:  
                          cout<<"\n\n Enter Marks of VB :--->";  
                          cin>>sub2;  
                          cout<<"\n";  
                          break;  
                     case 12:  
                          cout<<"\n\n Enter Marks of OS :--->";  
                          cin>>sub3;  
                          cout<<"\n";  
                          break;  
                     case 13:  
                          cout<<"\n\n Enter Marks of SAD :--->";  
                          cin>>sub4;  
                          cout<<"\n";  
                          break;  
                     default:  
                          cout<<"\n\n=======> Invalid Choice <=========\n ******** Try again ********\n\n";  
                          break;  
                }  
           }  
 };  
 int main()  
 {  
      //clrscr();  
      master ms;  
      while(1)  
      {  
           cout<<"\n\t==============> Master Database <================\n";  
           cout<<"\n\n\t ********** Choose Operation You Want To Perform **********\n\n";  
           cout<<"\n\n\t 1) Create Record";  
           cout<<"\n\n\t 2) Display Record";  
           cout<<"\n\n\t 3) Update Record";  
           cout<<"\n\n\t 4) Exit Program";  
           cout<<"\n\n Enter your choice====>";  
           int ch;  
           cin>>ch;  
           switch(ch)  
           {  
                case 1:  
                     ms.create();  
                     break;  
                case 2:  
                     ms.display();  
                     break;  
                case 3:  
                     ms.update();  
                     break;  
                case 4:  
                     goto out;  
                default:  
                     cout<<"\n\n\t========> Invalid choice <========";  
                     break;  
           }  
      }  
      out:  
 getch();  
 }  

Sensor pada AC menggunakan C++

Pada AC asli, biasanya terdapat 2 buah sensor yaitu
1. Sensor PIR, digunakan untuk menghitung jumlah orang
2. Sensor SHT75, digunakan untuk menghitung kelembaban ruangan
Pengecekan oleh sensor diatas biasanya dilakukan setiap 15 menit sekali

Pada source code C kita kali ini, input yang dimasukkan untuk menghitung jumlah orang dan kelembaban oleh sensor akan dimasukkan secara manual oleh kita.

Di source code kali ini, tingkat jumlah orang dan kelembaban akan kita bagi menjadi 3 (rendah, sedang, dan tinggi) sebagai berikut
1. Tingkat jumlah orang:
    a. rendah: 0-14
    b. sedang: 15-25
    c. tinggi: >25
2. Tingkat kelembaban:
    a. rendah: 0-25
    b. sedang: 26-69
    c. tinggi: >69

Pada bagian sensor.cpp, pada baigan int main, terdapat variabel bernama tabel aturan. Tabel aturan terdiri dari 3 deret angkat (a, b, c).
- a merupakan angka untuk perubahan temperatur
- b merupakan angka untuk fan speed
-c merupakan angka untuk kecepatan swing

Berikut adalah source code C++ untuk sensor pada AC

sensor.cpp
 #include<iostream>  
 #include<math.h>  
 #include<string>  
 #include<stdlib.h>  
 #include "AC.h"  
 #include "Sensor.h"  
 using namespace std;  
 int checkJumlahOrang(int jumlahOrang){  
   int hasil;  
   if(jumlahOrang>=0 && jumlahOrang<=14)  
     hasil=0;  
   else if(jumlahOrang>=15 && jumlahOrang<=25)  
     hasil=1;  
   else  
     hasil=2;  
 return hasil;  
 }  
 int checkKelembaban(float kelembaban){  
   int hasil;  
   if(kelembaban>=0 && kelembaban<=25)  
     hasil=0;  
   else if(kelembaban>=26 && kelembaban<=69)  
     hasil=1;  
   else  
     hasil=2;  
 return hasil;  
 }  
 void setAturan(AC *objekAC, Sensor *objekSensor, string tableAturan[3][3], int rangeSuhu[3][2]){  
   cout << "\nmasuk setAturan\n" << endl;  
   string aturan = tableAturan[objekSensor->getTingkatJumlahOrang()][objekSensor->getTingkatKelembaban()];  
   int koma[2], ubahTemperatur, indeksRangeSuhu, ubahFanSpeed;  
   koma[0] = aturan.find_first_of(",");  
   koma[1] = aturan.find_last_of(",");  
   //ganti temperatur  
   ubahTemperatur = atoi(aturan.substr(0,koma[0]).c_str());  
   cout << "ubah temperatur : " << ubahTemperatur << endl;  
   indeksRangeSuhu = objekSensor->getTingkatJumlahOrang();  
   if(objekAC->getTemperatur()+ubahTemperatur>=rangeSuhu[indeksRangeSuhu][0] && objekAC->getTemperatur()+ubahTemperatur<=rangeSuhu[indeksRangeSuhu][1])  
     objekAC->setTemperatur(objekAC->getTemperatur()+ubahTemperatur);  
   cout << "temperatur in setAturan : " << objekAC->getTemperatur() << endl;  
   //set swing  
   if(aturan.substr(koma[1]+1,1).compare("0")==0)  
     objekAC->setSwing(false);  
   else  
     objekAC->setSwing(true);  
   //set fan speen  
   ubahFanSpeed = atoi(aturan.substr(koma[0]+1,koma[1]-koma[0]-1).c_str());  
   objekAC->setFanSpeend(ubahFanSpeed);  
   return;  
   //cout << aturan << endl;  
   //cout << aturan.substr(0,koma[0]) << endl;  
   //cout << aturan.substr(koma[0]+1,koma[1]-koma[0]-1) << endl;  
   //cout << aturan.substr(koma[1]+1,1) << endl;  
   //cout << atoi(aturan.substr(0,1).c_str())+atoi(aturan.substr(2,1).c_str()) << endl;  
 }  
 int main(){  
   string tableAturan[3][3] = { {"0,1,0","0,1,0","1,1,0"},  
             {"0,2,1","-1,2,1","-1,1,0"},  
             {"-2,3,1","-1,2,1","0,1,1"}};  
   //rangeSuhu digunakan untuk membatasi perubahan suhu berdasarkan jumlah orang, rendah sedang tinggi  
   int rangeSuhu[3][2] = { {24,27},  
               {19,23},  
               {15,18}};  
   int indeksRangeSuhu, nilaiTengahRangeSuhu, tingkatJumlahOrangSebelum;  
   Sensor objekSensor(-1);  
   AC objekAC;  
   int jumlahOrang, tingkatKelembaban, tingkatJumlahOrang;  
   float kelembaban;  
   while(true){  
     cout << "Program akan berjalan terus, tekan CTRL+C untuk exit" << endl;  
     cout << "Jumlah orang : " << endl;  
     cin >> jumlahOrang;  
     cout << "Kelembaban : " << endl;  
     cin >> kelembaban;  
     cout << endl;  
     if(objekSensor.getTingkatJumlahOrang()==-1){  
       objekAC.setPower(true, 0, false);  
     }  
     if(jumlahOrang==0){  
       objekAC.setPower(false, 0, false);  
       objekSensor.setTingkatJumlahOrangKelembaban(-1, -1);  
       break;  
     }  
     objekSensor.setJumlahOrangKelembaban(jumlahOrang, kelembaban);  
     tingkatJumlahOrangSebelum = objekSensor.getTingkatJumlahOrang();  
     objekSensor.setTingkatJumlahOrangKelembaban(checkJumlahOrang(objekSensor.getJumlahOrang()), checkKelembaban(objekSensor.getKelembaban()));  
     //objek baru terbentuk  
     if(tingkatJumlahOrangSebelum == -1 || tingkatJumlahOrangSebelum!=objekSensor.getTingkatJumlahOrang()){  
       indeksRangeSuhu = objekSensor.getTingkatJumlahOrang();  
       cout << "indeks range suhu : " << indeksRangeSuhu << endl;  
       nilaiTengahRangeSuhu = floor((rangeSuhu[indeksRangeSuhu][1]-rangeSuhu[indeksRangeSuhu][0])/2);  
       cout << "nilai tengah range suhu : " << nilaiTengahRangeSuhu << endl;  
       objekAC.setTemperatur(nilaiTengahRangeSuhu+rangeSuhu[indeksRangeSuhu][0]);  
       cout << "temperatur in if : " << objekAC.getTemperatur() << endl;  
     }  
     setAturan(&objekAC, &objekSensor, tableAturan, rangeSuhu);  
     cout << "\nTemperatur sekarang : " << objekAC.getTemperatur() << endl;  
     cout << "Fan Speed sekarang : " << objekAC.getFanSpeen() << endl;  
     cout << "Swing sekarang : " << objekAC.getSwing() << endl;  
     cout << endl << endl;  
   }  
 return 0;  
 }  

AC.h
 #ifndef AC_H_  
 #define AC_H_  
 class AC{  
   int temperatur, fanSpeed;  
   bool swing, power;  
   public:  
     void setTemperatur(int);  
     void setSwing(bool);  
     void setPower(bool, int, bool);  
     void setFanSpeend(int);  
     int getTemperatur(){ return temperatur; };  
     int getFanSpeen(){ return fanSpeed; };  
     int getSwing(){ return swing; };  
 };  
 void AC::setTemperatur(int temperatur){  
   this->temperatur = temperatur;  
 }  
 void AC::setSwing(bool swing){  
   this->swing = swing;  
 }  
 void AC::setFanSpeend(int fanSpeed){  
   this->fanSpeed = fanSpeed;  
 }  
 void AC::setPower(bool power, int fanSpeed, bool swing){  
   this->power = power;  
   this->fanSpeed = fanSpeed;  
   this->swing = swing;  
 }  
 #endif  

Sensor.h
 #ifndef Sensor_H_  
 #define Sensor_H_  
 class Sensor{  
   int jumlahOrang, tingkatJumlahOrang, tingkatKelembaban;  
   float kelembaban;  
   public:  
     Sensor(int);  
     void setTingkatJumlahOrangKelembaban(int,int);  
     void setJumlahOrangKelembaban(int, float);  
     int getJumlahOrang(){ return jumlahOrang; };  
     float getKelembaban(){ return kelembaban; };  
     int getTingkatJumlahOrang(){ return tingkatJumlahOrang;};  
     int getTingkatKelembaban(){ return tingkatKelembaban;};  
 };  
 void Sensor::setJumlahOrangKelembaban(int jumlahOrang, float kelembaban){  
   this->jumlahOrang = jumlahOrang;  
   this->kelembaban = kelembaban;  
 }  
 void Sensor::setTingkatJumlahOrangKelembaban(int tingkatJumlahOrang, int tingkatKelembaban){  
   this->tingkatJumlahOrang = tingkatJumlahOrang;  
   this->tingkatKelembaban = tingkatKelembaban;  
 }  
 Sensor::Sensor(int tingkatJumlahOrang){  
   this->tingkatJumlahOrang = tingkatJumlahOrang;  
 }  
 #endif  

Simple ATM Simulator

Berikut adalah code C untuk sebuah simulator ATM yang sederhana.

Pengguna ATM simulator tersebut dapat melakukan hal-hal sebagai beriut:
1. Melakukan penarikan uang
2. Memasukkan setoran uang
3. Mengecek total uang didalam tabungan
4. Melakukan transfer

LOGIN
Account: 123456
Password: 123456

Berikut adalah contoh tampilan output




Berikut adalah source code :

 //Project: C++ ATM Program  
 #include <iostream>  
 #include <iomanip>  
 #include <stdlib.h>  
 #include <string>  
 #include <conio.h>  
 #include <time.h>  
 #include <string.h>  
 using namespace std;  
 void showMenu();  
 int mainMenuSelection(int);  
 void welcomeScreen();  
 void receipt();  
 void showLogo();  
 double enterAmountScreen(double);  
 void waiting(unsigned int mseconds)  
      {  
           clock_t goal = mseconds + clock();  
           while (goal > clock());  
      }  
 int main()  
 {  
 int choice, account;  
 string pin = "";  
 char ast;  
      cout << fixed << showpoint << setprecision(2);  
      welcomeScreen();  
      system("cls");  
      showLogo();  
      cout << "\n\n\t\t\t Please type your Bank Account Number : ";  
      cin >> account;  
      cout << "\n\t\t\t Please type Personal Identification Number(PIN) : ";  
      ast = _getch();  
      //cin >> pin;  
      while(ast!=13)  
      {  
    pin.push_back(ast);  
    cout << '*';  
    ast = _getch();  
      }  
  if (account!=123456 && pin!="123456")  
  {  
       cout << "\n\t\t\tInvalid Bank Account and PIN. Please try again!"<<endl;  
      getch();  
  }       
  else  
  {  
      //Create a do\while loop  
      do  
           {  
                //Display the menu and get the user's choice.  
                showMenu();  
                cin >> choice;  
                //Validate the menu selection.  
                while (choice < 1 || choice > 5)  
                {  
                     cout << "\n\t\t\tPlease enter your choice 1, 2, 3, 4, or 5: ";  
                     cin >> choice;  
                }  
                //Function to choose in the main menu selection  
           int withdrawChoice, depositChoice;  
           int checkBalanceChoice, fundsTransferChoice;  
           double money = 0.0;  
           char conf;  
                if (choice==1)  
                {                 
                          system("cls");  
                          showLogo();  
                          cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 WITHDRAWAL TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                          cout << "\n\n\t\t\t [ 1 ] From Checking" << endl;  
                          cout << "\t\t\t [ 2 ] From Savings" << endl;  
                          cout << "\t\t\t [ 3 ] Quick Cash" << endl;  
                          cout << "\t\t\t [ 4 ] Back to Main Menu" << endl;  
                          cout << "\t\t\t _____________________________________________"<<endl;  
                          cout << "\t\t\t Enter your withdraw transaction: ";  
                          cin >> withdrawChoice;  
                               while (withdrawChoice <1 || withdrawChoice >4 )  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 WITHDRAWAL TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2, 3 or 4 : ";  
                                         cin >> withdrawChoice;  
                                    }  
                               if (withdrawChoice == 4)  
                               {  
                                    showMenu();  
                               }  
                               //Quick Cash  
                               else if (withdrawChoice == 3)   
                               {  
                                    int amount1;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 QUICK CASH TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t REMAINING BALANCE : U$D 10000"<<endl;  
                                    cout << "\n\t\t\t Enter the Amount (U$D) : ";  
                                    cin >> amount1;  
                                    cout << "\n\t\t\t Your remaining quick cash balance: U$D "<<10000 - amount1<<endl;  
                                    waiting(3000);  
                                    receipt();  
                               cout << "\n\t\t\t|TRANSACTION:\t\t  QUICK WITHDRAWAL |"  
                                      << "\n\t\t\t|AMOUNT:\t\t  "<<amount1<<".00\t   |"  
                                      << "\n\t\t\t|CURRENT BAL:\t\t  "<<20000 - amount1<<".00\t   |"  
                                     << "\n\t\t\t|AVAILABLE BAL:\t\t  "<<20000 - amount1<<".00\t   |"  
                                     << "\n\t\t\t|\t\t\t\t\t   |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t   |"  
                                     << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";  
                                    waiting(10000);  
                                    showMenu();  
                               }  
                               else if (withdrawChoice == 2)  
                               {  
                                    int amount2;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CASH SAVINGS TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t AVAILABLE BALANCE : U$D 10000" << endl;  
                                    cout << "\t\t\t Enter the amount : ";  
                                    cin >> amount2;  
                                    cout << "\t\t\t Your remaining savings balance: U$D "<<10000 - amount2<<endl;  
                                    waiting(5000);  
                                    system("cls");  
                                    receipt();  
                               cout << "\n\t\t\t|TRANSACTION:\t\t  SAVINGS WITHDRAWAL|"  
                                      << "\n\t\t\t|AMOUNT:\t\t  "<<amount2<<".00\t   |"  
                                      << "\n\t\t\t|CURRENT BAL:\t\t  "<<20000 - amount2<<".00\t   |"  
                                     << "\n\t\t\t|AVAILABLE BAL:\t\t  "<<20000 - amount2<<".00\t   |"  
                                     << "\n\t\t\t|\t\t\t\t\t   |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t   |"  
                                     << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";  
                                    waiting(10000);  
                                    showMenu();  
                               }  
                               else if (withdrawChoice == 1)  
                               {  
                                    int amount3;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CASH CHECKING TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t AVAILABLE BALANCE : U$D 20000" << endl;  
                                    cout << "\t\t\t Enter the amount : ";  
                                    cin >> amount3;  
                                    cout << "\t\t\t Your remaining check balance: U$D "<<20000 - amount3<<endl;  
                                    waiting(3000);  
                                    system("cls");  
                                    receipt();  
                               cout << "\n\t\t\t|TRANSACTION:\t\t  CASH WITHDRAWAL  |"  
                                      << "\n\t\t\t|AMOUNT:\t\t  "<<amount3<<".00\t   |"  
                                      << "\n\t\t\t|CURRENT BAL:\t\t  "<<20000 - amount3<<".00\t   |"  
                                     << "\n\t\t\t|AVAILABLE BAL:\t\t  "<<20000 - amount3<<".00\t   |"  
                                     << "\n\t\t\t|\t\t\t\t\t   |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t   |"  
                                     << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";  
                                    waiting(10000);  
                                    showMenu();                                     
                               }  
                }  
                else if(choice==2)  
                {  
                               system("cls");  
                               showLogo();  
                               cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                               cout << "\n\n\t\t\t [ 1 ] To Checking" << endl;  
                               cout << "\t\t\t [ 2 ] To Savings" << endl;  
                               cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;  
                               cout << "\t\t\t _____________________________________________"<<endl;  
                               cout << "\t\t\t Enter your deposit transaction: ";  
                               cin >> depositChoice;  
                               while (depositChoice < 1 || depositChoice > 3)  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 : ";  
                                         cin >> depositChoice;  
                                    }  
                               if (depositChoice == 3)  
                               {  
                                    showMenu();  
                               }  
                               else if (depositChoice == 2)  
                               {  
                                    int depamount1;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t Enter the deposit amount : U$D ";  
                                    cin >> depamount1;  
                                    cout << "\t\t\t Your New Balance: U$D "<<depamount1+10000<<endl;  
                                    waiting(5000);  
                                    system("cls");  
                                    showMenu();                                
                               }  
                               else if (depositChoice == 1)  
                               {  
                                    int depamount2;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t Enter the deposit amount : U$D ";  
                                    cin >> depamount2;  
                                    cout << "\t\t\t Your New Balance: U$D "<<depamount2+20000<<endl;  
                                    waiting(5000);  
                                    system("cls");  
                                    showMenu();                                
                               }                           
                }  
                else if (choice==3)  
                {                           
                               system("cls");  
                               showLogo();  
                               cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK BALANCE TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                               cout << "\n\n\t\t\t [ 1 ] From Checking" << endl;  
                               cout << "\t\t\t [ 2 ] From Savings" << endl;  
                               cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;  
                               cout << "\t\t\t _____________________________________________"<<endl;  
                               cout << "\t\t\t Enter Your Check Balance Choice: ";  
                               cin >> checkBalanceChoice;  
                                    while (checkBalanceChoice < 1 || checkBalanceChoice > 3)  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK BALANCE TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 : ";  
                                         cin >> checkBalanceChoice;  
                                    }  
                               if (checkBalanceChoice == 3)  
                               {  
                                    showMenu();  
                               }  
                               else if (checkBalanceChoice ==2)  
                               {  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BALANCE SAVINGS TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t NEW AVAILABLE BALANCE : U$D 10000";  
                                    waiting(3000);  
                                    showMenu();  
                               }  
                               else if (checkBalanceChoice ==1)  
                               {  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BALANCE CHECK TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t NEW CHECK BALANCE : U$D 20000";  
                                    waiting(3000);  
                                    showMenu();  
                               }  
                }  
                else if (choice==4)  
                {       
                               system("cls");  
                               showLogo();  
                               cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 FUND TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                               cout << "\n\n\t\t\t [ 1 ] Transfer from Savings to Checking" << endl;  
                               cout << "\t\t\t [ 2 ] Transfer from Checking to Savings" << endl;  
                               cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;  
                               cout << "\t\t\t _____________________________________________"<<endl;  
                               cout << "\t\t\t Enter Your Funds Transfer Transaction: ";  
                               cin >> fundsTransferChoice;  
                               while (fundsTransferChoice < 1 || fundsTransferChoice > 3)  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 FUND TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 : ";  
                                         cin >> fundsTransferChoice;  
                                    }  
                               if (fundsTransferChoice == 3)  
                               {  
                                    showMenu();  
                               }  
                               else if (fundsTransferChoice ==2)  
                               {  
                                    int accntNo, checkNo, amntNo;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t NEW CHECK BALANCE : U$D 20000";  
                                    cout << "\n\t\t\t Account Number (for Transfer) : ";  
                                    cin >> accntNo;  
                                    cout << "\n\t\t\t Check Number : ";  
                                    cin >> checkNo;  
                                    cout << "\n\t\t\t Amount Transfer : U$D ";  
                                    cin >> amntNo;  
                                    while (amntNo < 2000 || amntNo > 20000)  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Amount!\n\t\t\t Please try again!";  
                                         cout << "\n\t\t\t Please enter Amount Transfer : U$D ";  
                                         cin >> amntNo;  
                                    }  
                                    waiting(1000);  
                                    cout << "\n\n\t\t\t The amount of U$D "<<amntNo<<" has been transfered to \n\t\t\t "<<accntNo<<" with a check # "<<checkNo<<endl;  
                                    waiting(10000);  
                                    showMenu();  
                               }  
                               else if (fundsTransferChoice ==1)  
                               {  
                                    int accntNo, checkNo, amntNo;  
                                    system("cls");  
                                    showLogo();  
                                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                    cout << "\n\n\t\t\t NEW SAVINGS BALANCE : U$D 10000";  
                                    cout << "\n\t\t\t Account Number (for Transfer) : ";  
                                    cin >> accntNo;  
                                    cout << "\n\t\t\t Amount Transfer : U$D ";  
                                    cin >> amntNo;  
                                    while (amntNo < 2000 || amntNo > 10000)  
                                    {  
                                         system("cls");  
                                         showLogo();  
                                         cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                                         cout << "\n\n\t\t\t Invalid Amount!\n\t\t\t Please try again!";  
                                         cout << "\n\t\t\t Please enter Amount Transfer : U$D ";  
                                         cin >> amntNo;  
                                    }  
                                    waiting(1000);  
                                    cout << "\n\n\t\t\t The amount of U$D "<<amntNo<<" has been transfered to "<<accntNo;  
                                    waiting(10000);  
                                    showMenu();  
                               }  
                }            
                else if (choice ==5)  
                {  
                               cout << " \n\t\t\t Thank You for Banking With Us!" << endl << endl;  
                               getch();  
                }  
           } while (choice != 5);  
  }  
           return 0;  
 }  
      //Function to display the welcome screen  
      void welcomeScreen()  
      {  
           cout<<"\n\t\t\t _____________________________________________"  
                <<"\n\t\t\t|\t\t\t\t\t   |\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
             <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 |"  
             <<"\n\t\t\t|\t\t\t\t\t   |\n\t\t\t| =============== We Find Ways ===============|";            
           cout << "\n\n\t\t\tPlease INSERT your Card [Press ENTER to insert card] ";  
           cin.get();  
      }  
      void showLogo()  
      {  
                cout<<"\n\t\t\t + ************** WELCOME TO *************** + ";  
                cout<<"\n\t\t\t _____________________________________________"  
                     <<"\n\t\t\t|\t\t\t\t\t   |\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t  \xB2\xB2\t\xB2\xB2\t  \xB2\xB2 |"  
                  <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 |"  
                  <<"\n\t\t\t|\t\t\t\t\t   |\n\t\t\t| =============== We Find Ways ===============|";            
      }  
      void showMenu()  
           {  
                system("cls");  
                showLogo();  
                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 MAIN MENU TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";  
                cout << "\n\n\t\t\t [ 1 ] Withdrawal" << endl;  
                cout << "\t\t\t [ 2 ] Deposit" << endl;  
                cout << "\t\t\t [ 3 ] Check Balance" << endl;  
                cout << "\t\t\t [ 4 ] Funds Transfer" << endl;  
                cout << "\t\t\t [ 5 ] Exit ATM" << endl;  
                cout << "\t\t\t _____________________________________________"<<endl;  
                cout << "\t\t\t Enter your Transaction: ";  
           }  
      void receipt()  
      {  
                system("cls");  
                showLogo();  
                char date[9];  
                char time[9];  
                _strdate(date);  
                _strtime(time);  
                cout << "\n\n\t\t\t\t\t PRINTING RECEIPT . . .\n";  
                waiting(3000);  
                system("cls");  
                showLogo();  
                cout << endl <<"\n\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BANCO DE ORO \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";  
                cout << "\n\t\t\t|\t\t\t\t\t   |"  
                      << "\n\t\t\t|\t   ATM TRANSACTION RECORD\t   |"  
                      << "\n\t\t\t|\t\t\t\t\t   |"  
                      << "\n\t\t\t|DATE:\t\t\t  "<<date<<"\t   |"  
                      << "\n\t\t\t|TIME:\t\t\t  "<<time<<"\t   |"  
                      << "\n\t\t\t|LOCATION:\t\t  MASBATE \t   |"  
                      << "\n\t\t\t|CARD NUM:\t\t  ************1215 |";  
      }  
           //Function to enter amount screen  
           double enterAmountScreen(double money)  
           {  
                system("cls");  
                int decision;  
                     cout << endl << "\t\tEnter Amount Screen" << endl;  
                     cout << "[ 1 ] Enter Amount:";  
                     cout << endl << "[ 2 ] Back to Main Menu:";  
                     cout << endl << "Enter your decision for the amount screen: ";  
                     cin >> decision;  
                     if (decision == 2)  
                          {  
                               showMenu();  
                          }  
                     else  
                          {  
                               cout << "Please enter the amount: ";  
                               cin >> money;  
                          }  
                return money;  
           }  

Menebak zodiac berdasarkan tanggal lahir

Berikut adalah source code C dimana user tinggal memasukkan tanggal dan bulan kelahirannya dan hasil output nya adalah nama zodiacnya

berikut adalah source code nya

 #include<iostream>  
 using namespace std;  
 int main() {  
      int a = 0;  
      int date,month;  
      start:  
      cout << "\n\n\n\t\t"  
          " This Program will determine your Zodiac Sign."  
          " \n\n\n\n\t\t  "  
          "  Input Your Birth Month No.: ";  
      cin >> month;  
      cout << " \n\t\t  "  
                "  Input Your Birth Date: ";  
      cin >> date;  
      if (month == 3 && date >= 21 || month == 4 && date <= 20)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac Sign is Aries! "; cout<<endl;  
      }  
   else if (month == 4 && date >= 21 || month == 5 && date <= 21)  
   {  
           cout<<"\n\n\n\t\t    Your Zodiac sign is Taurus"; cout<<endl;  
      }  
   else  
      if (month == 5 && date >= 22 || month == 6 && date <= 22)  
   {   
           cout<<"\n\n\n\t\t    Your Zodiac sign is Gemini"; cout<<endl;  
      }  
   else if (month == 6 && date >= 23 || month == 7 && date <= 23)  
   {   
           cout<<"\n\n\n\t\t    Your Zodiac is Cancer"; cout<<endl;  
      }  
   else if (month == 7 && date >= 24 || month == 8 && date <= 23)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Leo"; cout<<endl;  
      }  
   else if (month == 8 && date >= 24 || month == 9 && date <= 23)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Virgo"; cout<<endl;  
      }  
   else if (month == 9 && date >= 24 || month == 10 && date <= 23)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Libra"; cout<<endl;  
      }  
   else if (month == 10 && date >= 24 || month == 11 && date <= 22)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Scorpio"; cout<<endl;  
      }  
   else if (month == 11 && date >= 24 || month == 12 && date <= 21)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Saguittarius"; cout<<endl;  
      }  
   else if (month == 12 && date >= 22 || month == 1 && date <= 20)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Capricorn"; cout<<endl;  
      }  
   else if (month == 1 && date >= 21 || month == 2 && date <= 19)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Aquarius"; cout<<endl;  
      }  
   else if (month == 2 && date >= 20 || month == 3 && date <= 20)  
   {  
            cout<<"\n\n\n\t\t    Your Zodiac sign is Pieces"; cout<<endl;  
      }    
      else {  
        cout << "\n\t\t\t Incorrect Input!! Try Again! ";  
        system ("pause");  
        system("cls");  
        goto start;  
      }  
      cout << " \n\n \t\t To Try Again Press 1, or Press 2 to Quit ";  
   cin >> a;  
   system ("cls");   
   if (a==1)  
   goto start;  
   if (a==2)  
   {        
   cout << "\n";  
      }  
      return 0;  
 }  

Berikut adalah tampilan output nya

Membuat kamus sederhana

Berikut adalah source code C untuk membuat sebuah kamus sederhana

User / pengguna dapat melakukan beberapa hal di kamus ini, yaitu:
1. Add word, untuk memasukkan sebuah kata baru dan juga memasukkan arti dari kata tersebut ke dalam kamus
2. Search word, untuk para pengguna mencari kata yang ingin mereka ketahui artinya
3. Show dictionary, untuk menunjukkan isi lengkap kata-kata yang ada didalam kamus

Berikut adalah source code C nya

 /* Dictionary */  
 #include <stdio.h>  
 #include <conio.h>  
 #include <malloc.h>  
 #include <stdlib.h>  
 #include <string.h>  
 #include <ctype.h>  
 #include <windows.h>  
 struct node  
 {  
      char data [ 20 ] ;  
      char m [ 5 ] [ 20 ] ;  
      int mcount ;  
      struct node * link ;  
 } ;  
 struct node * dic [ 26 ] ;  
 void add ( char * ) ;  
 int search ( char * ) ;  
 void show( ) ;  
 void deldic( ) ;  
 int main( )  
 {  
      char word [ 20 ] , ch ;  
      int i ;  
      system ( "cls" ) ;  
      while ( 1 )  
      {  
           system ( "cls" ) ;  
           printf ( "\n\t\tDictionary\n" ) ;  
           printf ( "\n\t\t1.Add Word.\n" ) ;  
           printf ( "\t\t2.Search Word.\n" ) ;  
           printf ( "\t\t3.Show Dictionary.\n" ) ;  
           printf ( "\t\t0.Exit." ) ;  
           printf ( "\n\n\t\tYour Choice ") ;  
           scanf ( "%d", &ch ) ;  
           switch ( ch )  
           {  
                case 1 :  
                     printf ( "\nEnter any word : " ) ;  
                     fflush ( stdin ) ;  
                     gets ( word ) ;  
                     add ( word ) ;  
                     break ;  
                case 2 :  
                     printf ( "\nEnter the word to search : " ) ;  
                     fflush ( stdin ) ;  
                     gets ( word ) ;  
                     i = search ( word ) ;  
                     if ( ! i )  
                          printf ( "Word does not exists." ) ;  
     getch( ) ;  
                     break ;  
                case 3 :  
                     show( ) ;  
     getch( ) ;  
                     break ;  
                case 0 :  
                     deldic( ) ;  
                     exit ( 0 ) ;  
                default :  
                     printf ( "\nWrong Choice" ) ;  
           }  
      }  
  return 0 ;  
 }  
 void add ( char * str )  
 {  
      int i, j = toupper ( str [ 0 ] ) - 65 ;  
      struct node * r, * temp = dic [ j ], * q ;  
      char mean [ 5 ] [ 20 ], ch = 'y' ;  
      i = search ( str ) ;  
      if ( i )  
      {  
           printf ( "\nWord already exists." ) ;  
           return ;  
      }  
      q = ( struct node * ) malloc ( sizeof ( struct node ) ) ;  
      strcpy ( q -> data, str ) ;  
      q -> link = NULL ;  
      for ( i = 0 ; tolower ( ch ) == 'y' && i < 5 ; i++ )  
      {  
           fflush ( stdin ) ;  
           printf ( "\n\nEnter the meaning(s) : " ) ;  
           gets ( mean [ i ] ) ;  
           strcpy ( q -> m [ i ] , mean [ i ] ) ;  
           if ( i != 4 )  
                printf ( "\nAdd more meanings (y/n) " ) ;  
           else  
                printf ( "You cannot enter more than 5 meanings." ) ;  
           fflush ( stdin ) ;  
           ch = getche( ) ;  
      }  
      q -> mcount = i ;  
      if ( dic [ j ] == NULL || strcmp ( dic [ j ] -> data, str ) > 0 )  
      {  
           r = dic [ j ] ;  
           dic [ j ] = q ;  
           q -> link = r ;  
           return ;  
      }  
      else  
      {  
           while ( temp != NULL )  
           {  
                if ( ( strcmp ( temp -> data, str ) < 0 ) && ( ( strcmp ( temp -> link -> data, str ) > 0 ) ||  
                                                        temp -> link == NULL ) )  
                {  
                     q -> link = temp -> link ;  
                     temp -> link = q ;  
                     return ;  
                }  
                temp = temp -> link ;  
           }  
      }  
 }  
 int search ( char *str )  
 {  
      struct node *n ;  
      char temp1 [ 20 ] ;  
      char temp2 [ 20 ] ;  
      int i ;  
      n = dic [ toupper ( str [ 0 ] ) - 65 ] ;  
      strcpy ( temp2, str ) ;  
      strupr ( temp2 ) ;  
      while ( n != NULL )  
      {  
           strcpy ( temp1, n -> data ) ;  
           if ( strcmp ( strupr ( temp1 ), temp2 ) == 0 )  
           {  
                printf ( "\n%s\t\t%s", n -> data, n -> m [ 0 ] ) ;  
                for ( i = 1 ; i < n -> mcount ; i++ )  
                     printf ( "\n\t\t%s", n -> m [ i ] ) ;  
                return 1 ;  
           }  
           n = n -> link ;  
      }  
      return 0 ;  
 }  
 void show( )  
 {  
      struct node *n ;  
      int i, j ;  
      printf ( "Word\t\tMeaning\n" ) ;  
      for ( i = 0 ; i <= 30 ; i++ )  
           printf ( "-" ) ;  
      for ( i = 0 ; i <= 25 ; i++ )  
      {  
           n = dic [ i ] ;  
           while ( n != NULL )  
           {  
                printf ( "\n%s\t\t%s", n -> data, n -> m [ 0 ] ) ;  
                for ( j = 1 ; j < n -> mcount ; j++ )  
                     printf ( "\n\t\t%s", n -> m [ j ] ) ;  
                n = n -> link ;  
           }  
      }  
 }  
 void deldic( )  
 {  
      struct node *n, *t ;  
      int i ;  
      for ( i = 0 ; i <= 25 ; i++ )  
      {  
           n = dic [ i ] ;  
           while ( n != NULL )  
           {  
                t = n -> link ;  
                free ( n ) ;  
                n = t ;  
           }  
      }  
 }  

Berikut adalah contoh tampilan output nya

Departemen Store Management System

Berikut adalah source code C++ untuk membuat Department Store Management System yang sederhana. Pengguna dapat melakukan:
1. Login, untuk mengetahui apakah user tersebut adalah pelanggan atau admin
2. Modify Data, hanya dapat dilakukan oleh admin dan digunakan untuk mengatur (menambah atau mengubah atau menghapus) record barang-barang
3. Search, untuk para pengguna agar dapat mencari barang yang diinginkan dengan cepat
4. Sales, untuk para pelanggan melakukan penjualan

Untuk source code nya adalah seperti berikut

 /*  
  ***********************************************************  
  * project on                       *  
  * Departmental store management system          *  
  ***********************************************************  
 */  
 #include<iostream.h> //for input output stream regulation  
 #include<conio.h>   //for getch()and clreo/ clrscr  
 #include<fstream.h> //for file  
 #include<string.h>  //for strcmp()  
 #include<stdio.h>   // for input and output/ fflush()  
 #include<dos.h>    // for delay()  
 #include<process.h>  // for exit()  
 class departmental     // class defined  
  {  
   private:  
    char gname[30];  
    int price,new_price,qty;       // private memebers  
    int id,tc;  
    int quantity;  
    double total,qt,tot,stot,prof;  
   public:  
    void add_record();  
    void show_record();         // public members  
    void search_record();  
    void search_record_name();  
    void update_record();  
    void delete_record();  
    void tasks();  
    int check_id();  
    void sales();  
    void notification();  
    void report();  
  };    // end of class departmental  
 class extra             // class extra defined  
  {  
  private:  
    int i ,j ;  
  public:  
   void music();  
   void mainmenu();  
   void blink_message(char msg[]);  
   void subblinkmessage(char msg[]);  
   void line1(int x, int y, int z);  
   void line(int x, int y, int z);  
   void colors(void);  
   void lines(void);  
   int current_year;  
   int rem;  
  };                // end of class  
 class dates       //declaration for class "date"  
 {  
  private:  
  int date;  
  int month;  
  int year;  
  public:  
  void enter_date();  
  void show_date();  
 };           //end of class "date"  
 departmental d1;  
 extra e1;  
 dates D1;  
 void extra:: colors(void)    // for background color  
 {  
   for (i=0; i<26; i++)  
   {  
     for (j=0; j<80; j++)  
     cprintf(" ");  
     textbackground(5);  
   }  
 }  
 int departmental:: check_id()    // for generating unique id  
  {  
     fstream fp;  
     int k,j=1;  
     fp.open("customer.txt",ios::in);  
     k=0;  
     while(fp.read((char *)&d1,sizeof(d1)))  
     {  
      j=id;  
      k++;  
     }  
     fp.close();  
     if(k!=0)  
     j=j+1;  
     return j;  
  }          // end of function  
 void extra::line1(int x,int m,int a)  // function for drawing horizontal line  
  {  
   for(i=5;i<a;i++)  
    {  
     gotoxy(m,x);  
     cout<<"-";  
     m++;  
    }  
  }  
 void extra::line(int a,int m,int x)  // function for drawing vertical line  
  {  
   for(i=0;i<x;i++)  
   {  
    gotoxy(a,m);  
    cout<<"|";  
    m++;  
   }  
  }  
 void extra::blink_message(char msg[]) // function for message blinking.  
 {  
  textbackground(8);  
  textcolor(YELLOW+BLINK);  
  gotoxy(30,8);  
  cprintf(msg);  
  cout<<"\n";  
  textcolor(YELLOW);  
 }  
 void extra::subblinkmessage(char msg[]) // subblinking message function.  
 {  
  textbackground(8);  
  textcolor(YELLOW+BLINK);  
  gotoxy(26,21);  
  cprintf(msg);  
  printf("\n");  
  textcolor(YELLOW);  
 }  
 void extra::lines(void)   // drawing lines  
 {  
  for(i=0;i<80;i++)  
  cout<<"*";  
 }  
 void extra::music()     // producing 7HZ sound .  
  {  
   sound(440);  
   delay(250);  
   nosound();  
  }  
 void extra::mainmenu()   // showing main menu  
 {  
   e1.colors();  
   D1.show_date();  
   textbackground(BLUE);  
   textcolor(WHITE);  
   gotoxy(1,3);  
   cprintf("             DEPARTMENTAL STORE MANAGEMENT SYSTEM            ");  
   gotoxy(1,4);  
   cprintf("                  Birtamode,Jhapa               ");  
   e1.lines();  
   textbackground(RED);  
   gotoxy(73,1);  
   cprintf("Close[X]");  
   textcolor(WHITE);  
   textbackground(7);  
   gotoxy(1,5);  
   cprintf("      ");  
   gotoxy(4,5);  
   textcolor(RED);  
   cprintf("F");  
   gotoxy(5,5);  
   textcolor(0);  
   cprintf("ile    ");  
   gotoxy(16,5);  
   textcolor(RED);  
   cprintf("E");  
   gotoxy(17,5);  
   textcolor(0);  
   cprintf("dit     ");  
   gotoxy(29,5);  
   textcolor(RED);  
   cprintf("S");  
   gotoxy(30,5);  
   textcolor(0);  
   cprintf("earch     ");  
   gotoxy(44,5);  
   textcolor(RED);  
   cprintf("B");  
   gotoxy(45,5);  
   textcolor(0);  
   cprintf("illing    ");  
   gotoxy(58,5);  
   textcolor(RED);  
   cprintf("H");  
   gotoxy(59,5);  
   textcolor(0);  
   cprintf("elp    ");  
   gotoxy(68,5);  
   textcolor(RED);  
   cprintf("O");  
   gotoxy(69,5);  
   textcolor(0);  
   cprintf("ptions   ");  
   gotoxy(1,22);  
   textcolor(WHITE);  
   e1.lines();  
  }  
 void dates::enter_date()         // for date  
 {  
  clrscr();  
  cout<<"\n\nFirst of all I need the current date ..."<<"\n";  
  cout<<"\nYear : ";  
  cin>>year;  
  while(year<2000||year>10000)  
  {  
  clreol();  
  cout<<"\aInvalid input for year !!!"<<"\n";  
  clreol();  
  cout<<"Please enter the year correctly : "<<"\n";  
  cin>>year;  
  }  
  e1.current_year=year;  
  cout<<"Month : ";  
  clreol();  
  cin>>month;  
  while(month<=0||month>12)  //if month is greater then 12 or less then 1  
  {  
  clreol();  
  cout<<"\nInvalid input for month !!!"<<"\n";  
  clreol();  
  cout<<"Please enter the month correctly : \a"<<"\n";  
  clreol();  
  cin>>month;  
  }  
  cout<<"Date : ";  
  clreol();  
  switch(month)  
  {  
  case 1:  
  case 3:  
  case 5:  
  case 7:  
  case 8:  
  case 10:  
  case 12:{  
        cin>>date;  
        while(date<1||date>31)  //for months with 31 days  
        {  
        cout<<"\aInvalid date !!!"<<"\n";  
        cout<<"Again enter the date : "<<"\n";  
        clreol();  
        cin>>date;  
        }  
        break;  
       }  
  case 2:{  
       cin>>date;         //for february  
       if(year%4==0)  
       {  
        while(date<0||date>29)  //for leap year  
        {  
        cout<<"\aInvalid date !!!"<<"\n";  
        cout<<"Again enter the date : "<<"\n";  
        clreol();  
        cin>>date;  
        }  
       }  
       else  
       {  
        while(date<0||date>28)  //for non-leap year  
        {  
        cout<<"\aInvalid date !!!"<<"\n";  
        cout<<"Again enter the date : "<<"\n";  
        clreol();  
        cin>>date;  
        }  
       }  
       break;  
       }  
  default:{              //for other months with 30 days  
       cin>>date;  
       while(date<1||date>30)  
       {  
        cout<<"\aInvalid date !!!"<<"\n";  
        cout<<"Again enter the date : "<<"\n";  
        clreol();  
        cin>>date;  
       }  
       break;  
       }  
  }                     //end of switch  
 }            //end of function  
 void dates::show_date()       // showing date function  
 {  
  clrscr();  
  cout<<"Hello....\nIt's ";  
  cout<<date;  
  e1.rem=date%10;  
  switch(date)  
  {  
  case 11:  
  case 12:  
  case 13:  
  case 14:  
  case 15:  
  case 16:  
  case 17:  
  case 18:  
  case 19:  
  case 20:{  
        cout<<"th ";  
        goto over;  
       }  
  }  
  switch(e1.rem)  
  {  
  case 1:{  
       cout<<"st ";  
       break;  
       }  
  case 2:{  
       cout<<"nd ";  
       break;  
       }  
  case 3:{  
       cout<<"rd ";  
       break;  
       }  
  default:{  
       cout<<"th ";  
       break;  
       }  
  }           //end of switch  
  over:         //label for jump statement  
  switch(month)  
  {  
  case 1:{  
       cout<<"January , ";  
       break;  
       }  
  case 2:{  
       cout<<"February , ";  
       break;  
       }  
  case 3:{  
       cout<<"March , ";  
       break;  
       }  
  case 4:{  
       cout<<"April , ";  
       break;  
       }  
  case 5:{  
       cout<<"May , ";  
       break;  
       }  
  case 6:{  
       cout<<"June , ";  
       break;  
       }  
  case 7:{  
       cout<<"July , ";  
       break;  
       }  
  case 8:{  
       cout<<"August , ";  
       break;  
       }  
  case 9:{  
       cout<<"September , ";  
       break;  
       }  
  case 10:{  
       cout<<"October , ";  
       break;  
       }  
  case 11:{  
       cout<<"November , ";  
       break;  
       }  
  case 12:{  
       cout<<"December , ";  
       break;  
       }  
  }  
    //end of switch  
  cout<<year<<" \n";  
 }  
                //end of function  
 void main()          // main declaration  
  {  
   clrscr();  
   textcolor(GREEN);  
   cout<<"\n\t  %% %%  %%";  
   cout<<"\n\t  %% %%  %% %%%%% %%   %%%%%% %%%%%% %%%% %%%% %%%%%%";  
   cout<<"\n\t  %% %%  %% %%   %%   %%   %% %% %% %%% %% %%";  
   cout<<"\n\t  %% %%  %% %%%%% %%   %%   %% %% %% %%% %% %%%%%%";  
   cout<<"\n\t  %% %%  %% %%   %%   %%   %% %% %% % %% %%";  
   cout<<"\n\t  %%%%%%%%%%% %%%%%% %%%%%%% %%%%%% %%%%%% %% % %% %%%%%% ";  
   cout<<"\n\n\t            $$$$$$$$ $$$$$ ";  
   cout<<"\n\t              $$  $  $ ";  
   cout<<"\n\t              $$  $$$$$ ";  
   cout<<"\n\n\n   COMPUTER PROJECT (******** ON DEPARTMENTAL STORE MANAGEMENT *******)";  
   cout<<"\n\n\t\t           BY :-";  
   cout<<"\n\n\t\t\t* BHAWESH KAFLE"<<"\t BCA II ";  
   cout<<"\n\n\t\t\t* JEWAN SITOULA"<<"\t BCA II ";  
   cout<<"\n\n\t\t\t* DURGA SUBEDI "<<"\t BCA II ";  
   cout<<" \n\n\n\t\t press any KEY to continue: ";  
   getch();  
   clrscr();  
   char u[10],p[20],ch1,c,user[]="admin",pas[]="admin";  
   int n=0;  
   clrscr();  
   e1.colors();  
   e1.blink_message("User Authentication\n");  
   textcolor(RED);  
   gotoxy(20,10);  
   cprintf("Enter username and password(only 3 attempts)\n");  
   int i=0;  
   while(n<=2)            // conditon for password entry  
   {  
    textbackground(BLUE);  
    textcolor(WHITE);  
    textbackground(BLUE);  
    textcolor(WHITE);  
    gotoxy(1,1);  
    cprintf("             DEPARTMENTAL STORE MANAGEMENT SYSTEM              ");  
    gotoxy(1,2);  
    cprintf("                 Birtamode,Jhapa                ");  
    gotoxy(32,12);  
    cprintf("          ");  
    gotoxy(32,15);  
    cprintf("          ");  
    gotoxy(1,25);  
    cprintf("                                        ");  
    gotoxy(32,13);  
    cprintf(" Username:     ");  
    gotoxy(32,14);  
    cprintf(" Password:     ");  
    gotoxy(32,13);  
    cprintf(" Username:");  
    fflush(stdin);  
    cin>>u;  
    gotoxy(32,14);  
    fflush(stdin);  
    cprintf(" Password:");  
    ch1='\0';  
    i=0;  
    while(ch1!=13)  // showing asterik sign in place of password  
    {  
      fflush(stdin);  
      ch1=getch();  
      if(ch1!=13 && ch1!=8)  
      {  
       putch('*');  
       p[i] = ch1;  
       i++;  
      }  
    }  
    p[i] ='\0';  
    fflush(stdin);  
    textcolor(YELLOW);  
    if(strcmp(user,u)==0 && strcmp(pas,p)==0)// comparing username and password  
    {  
       D1.enter_date();  
       d1.tasks();  
    }  
   else             // password else part  
    {  
     e1.colors();  
     clrscr();  
     e1.blink_message("User Authentication!!");  
     textcolor(GREEN);  
     n++;  
     e1.music();  
     textbackground(RED);  
     gotoxy(1,7);  
     cprintf("\nSorry!! the username or password is incorrect. only %d trials left. enter again", 3-n);  
     fflush(stdin);  
    }  
  }  
  if(n==3)  
   {                 // password last attempt  
    clrscr();  
    e1.colors();  
    e1.blink_message("User Authentication!!");  
    textbackground(RED);  
    gotoxy(1,7);  
    cprintf("\n You have used maximum attempts(3).Please contact with Administrator.");  
    sleep(3);  
    exit(1);  
   }  
 }  
 fstream fp,fp2,fp3,fp4;     // declaring global files  
 void departmental::tasks()      //declaration of functioin "tasks"  
  {  
     textcolor(YELLOW);  
     e1.mainmenu();  
     textbackground(RED);  
     gotoxy(30,23);  
     cprintf("Press [h/H] for help");  
     gotoxy(1,23);  
     cprintf("Enter your choice:");  
     int c=getche();  
     switch(c)  
      {  
        case 'f':case 'F':     // file menu  
             textcolor(0);  
             textbackground(10);  
             gotoxy(1,6);  
             cprintf(" N:New record ");  
             gotoxy(1,7);  
             cprintf(" L:List record ");  
             gotoxy(1,8);  
             cprintf(" E: Exit    ");  
             gotoxy(1,23);  
             cprintf("Enter your choice:");  
             char ch;  
             ch=getche();  
             if(ch==27)  
              d1.tasks();  
             else  
              switch(ch)  
               {  
                 case 'n':case 'N':  // for adding new record  
                     d1.add_record();  
                     d1.tasks();  
                 case 'l':case 'L':  // for listing records  
                  e1.blink_message("Listing Record");  
                  d1.show_record();  
                  gotoxy(1,25);  
                  cprintf("[Press any key to go to the main page!!");  
                  getch();  
                  d1.tasks();  
                 case 'e':case 'E':   // for exit from program  
                 {  
                     textbackground(RED);  
                     e1.blink_message("Do you really want to exit.");  
                     textbackground(BLUE);  
                     gotoxy(37,10);  
                     cprintf("     ");  
                     gotoxy(37,11);  
                     cprintf("     ");  
                     gotoxy(37,12);  
                     cprintf("     ");  
                     gotoxy(37,13);  
                     cprintf("     ");  
                     gotoxy(37,14);  
                     cprintf("     ");  
                     textbackground(RED);  
                     gotoxy(40,11);  
                     cprintf("Exit");  
                     gotoxy(38,13);  
                     cprintf("[Y]");  
                     gotoxy(43,13);  
                     cprintf("[N]");  
                     char ch=getch();  
                     if(ch=='y')  
                      exit(0);  
                     else  
                      d1.tasks();  
                  }  
                 default:       // default choice  
                  e1.blink_message("Wrong choice!!!");  
                  e1.music();  
                  sleep(1);  
                  d1.tasks();  
               }  
        case 'e':case 'E':   // edit menu  
            {  
             textbackground(10);  
             gotoxy(10,6);  
             cprintf(" M:modify record ");  
             gotoxy(10,7);  
             cprintf(" D:delete record ");  
             gotoxy(1,23);  
             cprintf("Enter your choice:");  
             ch=getche();  
             if(ch==27)  
              d1.tasks();  
             else  
             switch(ch)  
              {  
                 case 'm':case 'M':   //for modifying records  
                   {  
                    d1.update_record();  
                    d1.tasks();  
                   }  
                 case 'd':case 'D':   // for deleting records  
                   {  
                    d1.delete_record();  
                    d1.tasks();  
                   }  
                 default:        // for default choice  
                   {  
                    e1.subblinkmessage("Wrong choice!!!!");  
                    e1.music();  
                    sleep(1);  
                    d1.tasks();  
                   }  
              }  
         case 's':case 'S':     // for searcing data  
            {  
             textbackground(10);  
             gotoxy(29,6);  
             cprintf(" N:By name ");  
             gotoxy(29,7);  
             cprintf(" D:By Id  ");  
             gotoxy(1,23);  
             cprintf("Enter your choice:");  
             ch=getche();  
             if(ch==27)  
              d1.tasks();  
             else  
             switch(ch)  
              {  
                 case 'n':case 'N':   //search by name  
                   {  
                    d1.search_record_name();  
                    d1.tasks();  
                   }  
                 case 'd':case 'D':   // search by id  
                   {  
                     d1.search_record();  
                     d1.tasks();  
                   }  
                 default:        // for default choice  
                   {  
                    e1.subblinkmessage("Wrong choice!!!!");  
                    e1.music();  
                    sleep(1);  
                    d1.tasks();  
                   }  
              }  
            }  
        case 'b':case 'B':      // for billing  
            {  
             d1.sales();  
             d1.tasks();  
            }  
        case 'h':case 'H':      // for help menu  
            {  
             textbackground(9);  
             textcolor(YELLOW);  
             gotoxy(20,6);  
             cprintf("******Help Menu*****");  
             gotoxy(1,8);  
             cprintf(" For file menu:# press [f/F]: This menu helps you to add,view and exit.  ");  
             gotoxy(1,10);  
             cprintf(" For Edit menu:# press [e/E]: This menu helps you to edit and delete record.  ");  
             gotoxy(1,12);  
             cprintf(" For Search menu:# press [s/S]: This menu help you to search the record. ");  
             gotoxy(1,14);  
             cprintf(" For Billing :# press [b/B] : This menu helps you for billing  ");  
             gotoxy(1,16);  
             cprintf(" For Help press:# press [h/H] : This is for help. ");  
             gotoxy(1,18);  
             cprintf(" For Option press:# [o/O] :This menu help you to show programmer details,report and notification.");  
             gotoxy(1,20);  
             cprintf("For exit option press [X] or goto to file menu and click[E].");  
             gotoxy(1,25);  
             cprintf("Press any key to go to main menu");  
             getch();  
             d1.tasks();  
            }  
        case 'o':case'O':    // for option menu  
             textbackground(10);  
             gotoxy(65,6);  
             cprintf(" A:About us   ");  
             gotoxy(65,7);  
             cprintf(" N:Notification ");  
           //  gotoxy(65,8);  
           //  cprintf(" R:Report    ");  
             gotoxy(1,23);  
             cprintf("Enter your choice:");  
             ch=getche();  
             if(ch==27)  
             d1.tasks();  
             else  
             switch(ch)  
               {  
                 case 'a':case 'A':     // for displaying about software history  
                  {  
                   textbackground(3);  
                   textcolor(YELLOW);  
                   gotoxy(1,8);  
                   cprintf("This project is the joint venture of Three programmers.");  
                   gotoxy(30,10);  
                   cprintf("Programmers Details");  
                   gotoxy(12,13);  
                   cprintf(" Name ");  
                   gotoxy(6,15);  
                   cprintf(" Bhawesh kafle ");  
                   gotoxy(6,17);  
                   cprintf(" jeewan sitoula ");  
                   gotoxy(6,19);  
                   cprintf(" Durga Subedi  ");  
                   gotoxy(36,13);  
                   cprintf(" Address ");  
                   gotoxy(34,15);  
                   cprintf(" Dhulabari-5 ");  
                   gotoxy(34,17);  
                   cprintf(" Birtamod  ");  
                   gotoxy(34,19);  
                   cprintf(" Birtamod  ");  
                   gotoxy(59,13);  
                   cprintf(" Contact address ");  
                   gotoxy(61,15);  
                   cprintf(" 9804917581 ");  
                   gotoxy(61,17);  
                   cprintf(" 9814625572 ");  
                   gotoxy(61,19);  
                   cprintf(" 9814023453 ");  
                   gotoxy(1,25);  
                   cprintf("Press any key to go to main menu!!");  
                   getch();  
                   d1.tasks();  
                  }  
                 case 'n':case 'N':  // for notifying stock  
                  {  
                   d1.notification();  
                   getch();  
                   d1.tasks();  
                  }  
             /*      case 'r':case 'R':  //for showing account history  
                  {  
                   d1.report();  
                   d1.tasks();  
                  }  
              */  
                 default:        // default choice  
                  {  
                    e1.subblinkmessage("Wrong choice!!!!");  
                    e1.music();  
                    sleep(1);  
                    d1.tasks();  
                  }  
               }  
        case 'x': case'X':  
           {  
            textbackground(RED);  
            e1.blink_message("Do you really want to exit.");  
            textbackground(BLUE);  
            gotoxy(37,10);  
            cprintf("     ");  
            gotoxy(37,11);  
            cprintf("     ");  
            gotoxy(37,12);  
            cprintf("     ");  
            gotoxy(37,13);  
            cprintf("     ");  
            gotoxy(37,14);  
            cprintf("     ");  
            textbackground(RED);  
            gotoxy(40,11);  
            cprintf("Exit");  
            gotoxy(38,13);  
            cprintf("[Y]");  
            gotoxy(43,13);  
            cprintf("[N]");  
            ch=getch();  
            if(ch=='y'| ch=='Y')  
             exit(0);  
            else  
             d1.tasks();  
           }  
                           // default choice  
        default:  
           {  
            e1.subblinkmessage("Wrong choice!!!!");  
            e1.music();  
            sleep(1);  
            d1.tasks();  
           }  
      }  
    }  
  }            //End of main  
 void departmental::add_record()      //declaration of function "add_record"  
  {  
    clreol();  
    e1.mainmenu();  
    e1.blink_message("Adding Records");  
    fp.open("customer.txt",ios::binary|ios::app);  
    fflush(stdin);  
    e1.line1(7,23,35);  
    e1.line(22,7,12);  
    e1.line1(10,23,35);  
    e1.line1(12,23,35);  
    e1.line1(14,23,35);  
    e1.line1(16,23,35);  
    e1.line1(18,23,35);  
    e1.line(53,7,12);  
    gotoxy(24,11);  
    cprintf("Enter goods name    ");  
    gotoxy(24,13);  
    cprintf("Enter goods price    ");  
    gotoxy(24,15);  
    cprintf("Enter the quantity   ");  
    gotoxy(25,10);  
    fflush(stdin);  
    id=d1.check_id();  
    gotoxy(24,11);  
    cprintf("Enter goods name:  ");  
    gets(gname);  
    gotoxy(24,13);  
    cprintf("Enter goods price: ");  
    cin>>price;  
    fflush(stdin);  
    gotoxy(24,15);  
    cprintf("Enter the quantity: ");  
    cin>>quantity;  
    fp.write((char*)&d1,sizeof(d1));  
    fp.close();  
    gotoxy(24,17);  
    cprintf("Files successfully saved!!!");  
    gotoxy(24,17);  
    cprintf("Do you want more again[y/n]");  
    char ch;  
    ch=getche();  
    if(ch=='y'|ch=='Y')  
    d1.add_record();  
  }                  // end of function  
 void departmental::show_record()    // declaration of function "show_record"  
  {  
   clreol();  
   e1.mainmenu();  
   int j=0;  
   fp.open("customer.txt",ios::in);  
   gotoxy(1,25);  
   e1.blink_message("Listing Record's");  
   textcolor(RED);  
   textbackground(3);  
   while(fp.read((char *)&d1,sizeof(d1)))  
     {  
      gotoxy(13,12+j);  
      cout<<d1.id<<"\t\t";  
      cout<<d1.gname<<"\t\t";  
      cout<<d1.quantity<<"\t\t";  
      cout<<d1.price<<"\t\t";  
       j++;  
     }  
   gotoxy(12,10);  
   cprintf(" Id     Name      Qty       price  \n");  
   e1.line1(7,11,61);  
   e1.line1(9,11,61);  
   e1.line1(11,11,61);  
   e1.line(10,7,13);  
   e1.line1(19,11,61);  
   e1.line(67,7,13);  
   e1.line(20,10,10);  
   e1.line(38,10,10);  
   e1.line(50,10,10);  
   fp.close();  
  }              // end of function  
 void departmental::search_record()   //declaration of function "search_record"  
  {  
  int d,i=0;  
  clreol();  
  fp.open("customer.txt",ios::in);  
  e1.blink_message("Searching Record");  
  e1.mainmenu();  
  fflush(stdin);  
  gotoxy(30,8);  
  cprintf("Enter ID for search:");  
  cin>>d;  
  while(fp.read((char *)&d1,sizeof(d1)))  
  {  
   if(id==d)  
    {  
     e1.blink_message(" Searched Record Found ");  
     textcolor(RED);  
     textbackground(3);  
     gotoxy(12,10);  
     cprintf(" Id     Name      Qty       price  \n");  
     gotoxy(12,12);  
     cout<<id<<"\t\t";cout<<gname<<"\t\t";cout<<quantity<<"\t\t";cout<<price<<"\t\t";  
     e1.line1(7,11,61);  
     e1.line1(9,11,61);  
     e1.line1(11,11,61);  
     e1.line(10,7,13);  
     e1.line1(19,11,61);  
     e1.line(67,7,13);  
     e1.line(20,10,10);  
     e1.line(38,10,10);  
     e1.line(50,10,10);  
     i++;  
    }  
  }  
  if(i==0)  
  {  
   e1.blink_message("Sorry!!! Record doesn't exist in our database!!\n");  
  }  
  fp.close();  
  gotoxy(1,25);  
  cprintf("Do you want to search again[y/n]");  
  int ch=getche();  
  if(ch=='y'|ch=='Y')  
  d1.search_record();  
 }                     // end of function  
 void departmental::search_record_name()   //declaration of function for searching records by name  
  {  
  int i=0,j=0;char name[30];  
  clreol();  
  fp.open("customer.txt",ios::in);  
  e1.blink_message("Searching Record");  
  e1.mainmenu();  
  fflush(stdin);  
  gotoxy(30,8);  
  cprintf("Enter name for search:");  
  gets(name);  
  while(fp.read((char *)&d1,sizeof(d1)))  
  {  
   if( strcmp(name,gname)==0)  
    {  
     e1.blink_message(" Searched Record Found ");  
     textcolor(RED);  
     textbackground(3);  
     gotoxy(12,10);  
     cprintf(" Id     Name      Qty       price  \n");  
     gotoxy(12,12+j);  
     cout<<id<<"\t\t";cout<<gname<<"\t\t";cout<<quantity<<"\t\t";cout<<price<<"\t\t";  
     e1.line1(7,11,61);  
     e1.line1(9,11,61);  
     e1.line1(11,11,61);  
     e1.line(10,7,13);  
     e1.line1(19,11,61);  
     e1.line(67,7,13);  
     e1.line(20,10,10);  
     e1.line(38,10,10);  
     e1.line(50,10,10);  
     j++;  
     i++;  
    }  
  }  
  if(i==0)  
  {  
   e1.blink_message("Sorry !!! Record doesn't exist in our database!!\n");  
  }  
  fp.close();  
  gotoxy(1,25);  
  cprintf("Do you want to search again[y/n]");  
  int ch=getche();  
  if(ch=='y'|ch=='Y')  
  d1.search_record_name();  
 }                  // end of functioin  
 void departmental:: update_record()   //declaration of functoin for modifying records  
 {  
   int k,d;  
   clreol();  
   d1.show_record();  
   e1.blink_message("Modifying Records");  
   k=0;  
   fp.open("customer.txt",ios::in);  
   fp2.open("test5.txt",ios::out);  
   fflush(stdin);  
   gotoxy(1,20);  
   cprintf("Enter the Id of goods to be modified:");  
   cin>>d;  
   while(fp.read((char *)&d1,sizeof(d1)))  
   {  
    if(id==d)  
    {  
    clreol();  
    e1.mainmenu();  
    fflush(stdin);  
    e1.blink_message("Modifying Record");  
    e1.line1(7,23,35);  
    e1.line(22,7,12);  
    e1.line1(10,23,35);  
    e1.line1(12,23,35);  
    e1.line1(14,23,35);  
    e1.line1(16,23,35);  
    e1.line1(18,23,35);  
    e1.line(53,7,12);  
    gotoxy(24,11);  
    cprintf("Enter goods name :     ");  
    gotoxy(24,13);  
    cprintf("Enter goods price :     ");  
    gotoxy(24,15);  
    cprintf("Enter the quantity:     ");  
    char goods[30];  
    gotoxy(24,11);  
    cprintf("Enter goods name :");  
    gets(goods);  
    strcpy(gname,goods);  
    gotoxy(24,13);  
    cprintf("Enter goods price :");  
    cin>>new_price;  
    price=new_price;  
    gotoxy(24,15);  
    fflush(stdin);  
    cprintf("Enter the quantity:");  
    cin>> qty;  
    quantity=qty;  
    fp2.write((char *)&d1,sizeof(d1));  
    k++;  
    }  
    else  
    fp2.write((char *)&d1,sizeof(d1));  
   }  
    fp.close();  
    fp2.close();  
    remove("customer.txt");  
    rename("test5.txt","customer.txt");  
     if(k==0)  
     {  
       e1.subblinkmessage("Sorry!! Record doesn't exist in our database");  
     }  
    else  
     {  
       e1.subblinkmessage("Successful!!Record has been modified");  
       d1.show_record();  
     }  
    gotoxy(1,24);  
    cprintf("Do you want to modify more records [y/n]");  
    char ch=getche();  
    if(ch=='y'|ch=='Y')  
    d1.update_record();  
  }                // end of function  
 void departmental::delete_record()   // for deleting records  
 {  
  int d;  
  int j=0;  
  clreol();  
  d1.show_record();  
  fp.open("customer.txt",ios::in|ios::binary);  
  fp2.open("test5.txt",ios::out|ios::binary);  
  fflush(stdin);  
  e1.blink_message("Deleting Records");  
  gotoxy(1,20);  
  cprintf("Enter the id of the item to be deleted:");  
  cin>>d;  
  while(fp.read((char *)&d1,sizeof(d1)))  
  {  
   if(d==d1.id)  
    j++;  
   else  
    fp2.write((char *)&d1,sizeof(d1));  
  }  
  fp.close();  
  fp2.close();  
  remove("customer.txt");  
  rename("test5.txt","customer.txt");  
   if(j==0)  
   {  
    e1.subblinkmessage("Sorry !!!Record not exist in our database");  
   }  
  else  
   {  
       e1.subblinkmessage("Such Record is deleted from our database");  
       d1.show_record();  
   }  
 // e1.mainmenu();  
 // d1.show_record();  
  gotoxy(1,25);  
  cprintf("Do you want to delete another record?[y/n]");  
  char ch;  
  ch=getche();  
  if(ch=='y'|ch=='Y')  
   d1.delete_record();  
  }           // end of function  
 // billing part  
 void departmental::sales()      // declaration of function sales  
  {  
    char name[30],add[30],goods[30],ch;  
    double pro,test;  
    int d,a=0,s;  
    double k=0,vat,dis,gtot,n,x;  
    clreol();  
    e1.mainmenu();  
    fflush(stdin);  
    e1.blink_message("Enter the Following data");  
    e1.line1(7,23,48);  
    e1.line(22,7,7);  
    e1.line1(9,23,48);  
    e1.line1(11,23,48);  
    e1.line1(13,23,48);  
    e1.line(65,7,7);  
    //Entering customer details  
    fp2.open("test5.txt",ios::binary|ios::app);  
    fp4.open("backup.txt",ios::binary|ios::app);  
    gotoxy(23,10);  
    cprintf("Enter the name of customer  :");  
    gotoxy(23,12);  
    cprintf("Enter the address of customer:");  
    gotoxy(23,10);  
    cprintf("Enter the name of customer  :");  
    gets(name);  
    gotoxy(23,12);  
    cprintf("Enter the address of customer:");  
    gets(add);  
    fp2.write((char *)&d1,sizeof(d1));  
    fp4.write((char *)&d1,sizeof(d1));  
    fp2.close();  
    fp4.close();  
    e1.line(52,9,5);  
    xx:  
    clreol();  
    e1.mainmenu();  
    d1.show_record();  
    fp2.open("test5.txt",ios::binary|ios::app);  
    fp3.open("copy.txt",ios::out|ios::binary);  
    fp.open("customer.txt",ios::in|ios::binary);  
    fp4.open("backup.txt",ios::binary|ios::app);  
   // clrscr();  
 //   clreol();  
  //  e1.mainmenu();// function for main menu  
   // d1.show_record();  
 //   e1.line1(7,23,35);  
  //  e1.line(22,7,5);  
   // e1.line1(9,23,35);  
   // e1.line1(11,23,35);  
   // e1.line(53,7,5);  
    gotoxy(23,20);  
    cprintf("Enter the Id of the item:");  
    cin>>d;  
    fflush(stdin);  
    while(fp.read((char *)&d1,sizeof(d1)))  
    {  
    if(d==id)  
      {  
        a:  
        gotoxy(23,21);  
        fflush(stdin);  
        cprintf("Enter the qty of the item:");  
        cin>>qt;  
        // checking the stock.  
        if(qt>quantity)  
         {  
          e1.subblinkmessage("Out of stock!!.. Please enter qty again.");  
          getch();  
          goto a;  
         }  
        else  
        {             /*calculating the amount*/  
         a=quantity-qt;  
         quantity=a;  
         tc=qt*(float)price;  
         k=(float)k+tc;  
         tot=k;  
         n=((float)pro+0.00*tot);//calculating total profit  
    //        prof=((float)prof+n);  
         vat=((float)0.13*tot);  
         // calculating discount percentage.  
         if (tot<1000)  
           dis=((float)0.00*tot);  
         else if(tot>=1000)  
           dis=((float)0.05*tot);  
         else if(tot>=3000)  
           dis=((float)0.10*tot);  
         else if( tot>=5000)  
           dis=((float)0.15*tot);  
         x=((float)(tot+vat)-dis); //calculating total sales  
         tot=x;  
       //  stot=((float)stot+tot);  
         fp2.write((char *)&d1,sizeof(d1));  
         fp3.write((char *)&d1,sizeof(d1));  
         fp4.write((char *)&d1,sizeof(d1));  
        }  
       fp2.close();  
       fp4.close();  
       }  
     else  
       fp3.write((char *)&d1,sizeof(d1));  
   }  
       fp.close();  
       fp3.close();  
       remove("customer.txt");  
       rename("copy.txt","customer.txt");  
       gotoxy(23,23);  
       cprintf("Do yo have Any other items??[Y/N]\n");  
       ch=getche();  
       if(ch=='y'|ch=='Y')  
        goto xx;  
        fp2.open("test5.txt",ios::binary|ios::in);  
        clrscr();  
        e1.colors();  
        textcolor(RED);  
        textbackground(BLUE);  
        e1.line(10,1,24);  
        e1.line(70,1,24);  
        e1.line1(1,11,65);  
        int j=0;  
        while(fp2.read((char *)&d1,sizeof(d1)))  
         {  
           n=price;  
          // display of bill  
           gotoxy(11,2);  
           cprintf("          B & J Departmental Store        ");  
           gotoxy(11,3);  
           cprintf("            Birtamode,jhapa          ");  
           gotoxy(11,4);  
           cprintf("              Nepal             ");  
           e1.line1(5,11,65);  
           gotoxy(37,5);  
           cprintf("TAX INVOICE");  
           e1.line1(9,11,65);  
           gotoxy(11,6);  
           cprintf(" Regd no:10432223");  
           gotoxy(11,7);  
           cout<<"Name   :"<<name;  
           gotoxy(11,8);  
           cout<<"Addrress :"<<add;  
           gotoxy(12,10);  
           cprintf(" Sn   Particulars    Qty    Rate   Amount(Rs)");  
           e1.line1(11,11,65);  
           fflush(stdin);  
           gotoxy(13,11+j);  
           cout<<j<<"  \t";cout<<gname<<"\t\t";cout<<qt<<"\t ";cout<<n<<"\t  ";cout<<tc<<"\n";  
        //     cout<<"\n";  
           j++;  
         }  
        e1.line(45,10,9);  
        e1.line(35,10,9);  
        e1.line(16,10,9);  
        e1.line(56,10,15);  
        e1.line1(18,11,65);  
        gotoxy(50,19);  
        cprintf("Total:");  
        gotoxy(58,19);  
        cout<<k;  
        e1.line1(20,11,65);  
        gotoxy(52,21);  
        cprintf("Vat:");  
        gotoxy(58,21);  
        printf("%.2f",vat);  
        gotoxy(52,22);  
        cprintf("Dis:");  
        gotoxy(58,22);  
        cout<<dis;  
        gotoxy(44,23);  
        cprintf("Grand total:");  
        gotoxy(58,23);  
        printf("%.2f",tot);  
        gotoxy(1,25);  
        cprintf("Press any key to exit from this bill.!!!!");  
        e1.line1(24,11,65);  
        fp2.close();  
        fp4.close();  
        remove("test5.txt");  
        getch();  
        e1.colors();  
        gotoxy(20,13);  
        cout<<"@@@@@@@ Thanks for you kind visit @@@@@@@";  
        gotoxy(1,24);  
        cout<<"Press any key to go to the main menu";  
        getch();  
    }                // end of function  
 /* void departmental::report()    // declaration of function report  
  {  
   fp4.open("backup.txt",ios::out|ios::binary);  
   while(fp4.read((char *)&d1,sizeof(d1)))  
    gotoxy(30,12);  
    cout<<"Total sales made :"<<stot;  
    gotoxy(30,14);  
    cout<<"Total profit made:"<<prof;  
    getch();  
    fp4.close();  
  }  
  {  
  float k;  
  FILE *fp4;  
  fp4=fopen("backup.txt","r");  
  gotoxy(10,10);  
  printf("invoice id     Name      Price       sales person");  
  gotoxy(10,11);  
  printf("---------------------------------------------------------------");  
  j=0;  
  while(fread(&c,sizeof(c),1,fp4)==1)  
   {  
    textcolor(WHITE);  
    gotoxy(10,12+j);  
    printf("   %s      %.2f ",c.name,c.test);  
    j++;  
   }  
   fclose(fp4);  
   getch();  
  }  
  */  
 void departmental::notification()   // declaration of function notification  
  {  
  fstream fp;  
  int j=0;  
  fp.open("customer.txt",ios::in|ios::binary);  
  e1.blink_message("*** Stock Notification ***");  
  gotoxy(15,10);  
  cprintf("Stock Id         Name       report");  
  while(fp.read((char *)&d1,sizeof(d1)))  
   {  
    if(quantity<=10)  
    {  
      gotoxy(11,11+j);  
      cout<<"\t"<<id;cout<<"\t\t\t"<<gname;cout<<"\t\t*Low";  
    }  
    else if(quantity>=10&&quantity<=59)  
    {  
      gotoxy(11,11+j);  
      cout<<"\t"<<id;cout<<"\t\t\t"<<gname<<"\t\tMedium";  
    }  
    else if(quantity>=60)  
    {  
      gotoxy(11,11+j);  
      cout<<"\t"<<id;cout<<"\t\t\t"<<gname;cout<<"\t\t GOOD";  
    }  
    j++;  
   }  
  fp.close();  
  e1.subblinkmessage("Press any key to go to main menu!!!!!");  
  }  

Berikut adalah contoh tampilan outputnya