Friday, October 6, 2017

Code Review: Banking Transactions System

Compiler or Tool: Turbo C

Programming Language: C++

User Interface Type: CUI [Character User Interface]

Description:

This Banking Transactions System allows bank administrative staff to maintain their customer database with details such as new account, modify and close account, withdraw account, balance enquiry etc. Even though the system is very small it teaches how to code simple file handling support system in C++ language.

The System contains one class, account with following properties and methods:

clip_image001

The main() function presents main menu and becomes single point entry and exit code. The main() function call graph is as follows:

clip_image002

The menu presented by this main() function is as follows:

clip_image004

 

The system uses basic commands to arrange data on screen and seven functions are used to manage the system. To study the code includes how files are read and write with simple menu.

Total code lines for this system are 355 lines [approximately]. It is a most suitably called as mini project in C++ language.

If you want to write or construct or program C++ mini-project and do not know how or from where to start buy this simple e-book: Code Review of 26 C++ mini-projects.

Note: For other details send request e-mail to mailforprojects@rediffmail.com. Add your comments in below available comment box.

Note: Click these label/tags to view all related posts. Tags: C++MiniProject

 

…till next post, bye-bye & take care.

Thursday, October 5, 2017

C++ Code Review: calculates sum of series of type 1+(1+2)+(1+2+3)+...n.

Description: This program calculates sum of series of type 1+(1+2)+(1+2+3)+...n.

Code:

//Compiling Tool: Code::Block IDE with MinGW

//Program calculates sum of series of type 1+(1+2)+(1+2+3)+...n.

 

#include<iostream>

#include<conio.h> //for getch()

 

using namespace std;

 

int main()

{

 

    int i,j,n,sum=0;

    cout<<"Series Type:1+(1+2)+(1+2+3)+...n"<<endl;

    cout<<"Enter the value of n:";

    cin>>n;

 

 

    for(i=1; i<=n; i++)

    {

        for(j=1; j<=i; j++)

        {

            sum+=j;

        }

    }

    cout<<"Sum: "<<sum;

    getch();

}

 

Output:

clip_image002

If you want to write or construct or program C++ mini-project and do not know how or from where to start buy this simple e-book: Code Review of 26 C++ mini-projects. For book sample click this link.

Add your comments in below available comment box.

Note: Click these label/tags to view all related posts. Tags: C++Code

 

…till next post, bye-bye & take care.

Tuesday, October 3, 2017

C++ Code Review: Overloading Binary Operator

Description: This program shows how to overload binary operators [such as +,-,* and /]. The program uses switch case constructor to present menu.

Code:

//Compiling Tool: Code::Block IDE with MinGW

//Program shows how to overload binary opertor

 

#include<iostream>

#include<conio.h> //for getch()

#include<process.h>

//#include<math.h>  //for sqrt()

#include<cstdlib> //for system()

 

using namespace std;

 

class demo

{

    float

    a,b;

 

public:

    void getdata();

    void display();

    demo

    operator +(demo);

    demo

    operator -(demo);

    demo

    operator *(demo);

    demo

    operator /(demo);

    int

    operator ==(demo);

};

 

void demo::getdata()

{

    cout<<"Enter values of a and b:";

    cin>>a>>b;

}

 

void demo::display()

{

    cout<<"a="<<a<<"\t b="<<b;

}

 

demo demo::operator +(demo d1)

{

    demo

    d2;

    d2.a=a+d1.a;

    d2.b=b+d1.b;

    return d2;

}

 

demo demo::operator -(demo d1)

{

    demo

    d2;

    d2.a=a-d1.a;

    d2.b=b-d1.b;

    return d2;

}

 

demo demo::operator *(demo d1)

{

    demo

    d2;

    d2.a=a*d1.a;

    d2.b=b*d1.b;

    return d2;

}

 

demo demo::operator /(demo d1)

{

    demo

    d2;

    d2.a=a/d1.a;

    d2.b=b/d1.b;

    return d2;

}

 

int demo::operator ==(demo d1)

{

    if((a==d1.a)&&(b==d1.b))

        return

            1;

    else

        return

            0;

}

 

int main()

{

    int ch;

    demo d1,d2,d3;

 

top:

    system("Cls");

 

    cout << endl;

    cout<<"***Operator Overloading Program***"<< endl;

    cout<<"   1. Addition"<< endl;

    cout<<"   2. Subtraction"<< endl;

    cout<<"   3. Multiplication"<< endl;

    cout<<"   4. Division"<< endl;

    cout<<"   5. Comparison"<< endl;

    cout<<"   6. Quit"<< endl;

    cout<<"Enter your Choice:_";

    cin>>ch;

 

    if(ch<6)

    {

        cout<<"First Object:\n";

        d1.getdata();

        cout<<"Second Object:\n";

        d2.getdata();

    }

 

    switch(ch)

    {

    case 1:

        d3=d1+d2;

        cout<<"Third Object:\n";

        d3.display();

        break;

    case 2:

        d3=d1-d2;

        cout<<"Third Object:\n";

        d3.display();

        break;

    case 3:

        d3=d1*d2;

        cout<<"Third Object:\n";

        d3.display();

        break;

    case 4:

        d3=d1/d2;

        cout<<"Third Object:\n";

        d3.display();

        break;

    case 5:

        if(d1==d2)

            cout<<"Objects are Equal";

        else

            cout<<"Objects are Not Equal";

        break;

    case 6:

        exit(0);

        break;

    default:

        cout<<"Wrong Choice!!!Press any key to exit";

    }

    getch();

    goto top;

}

 

Output:

clip_image002

If you want to write or construct or program C++ mini-project and do not know how or from where to start buy this simple e-book: Code Review of 26 C++ mini-projects. For book sample click this link.

Add your comments in below available comment box.

Note: Click these label/tags to view all related posts. Tags: C++Code

 

…till next post, bye-bye & take care.