Friday, October 13, 2017

Code Review: Canteen Management System

Compiler or Tool: Turbo C

Programming Language: C++

User Interface Type: CUI [Character User Interface]

Description:

This Canteen Management System allows library staff to maintain their customer-n-products database with details such as new product or customer entry, search, delete, modify or listing all customers or products etc. Even though the system is small size it teaches how to code simple file handling support system with intuitive menu in C++ language.

The System contains one class, consumer class 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 manipulators, basic commands to arrange data on screen and five functions are used to manage the system. To study the code includes how files are read and write with very fancy menu.

Note: The login passwords is “uday___”, or refer code or its documentation for it.

Total code lines for this system are 1347 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 12, 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 n;

    cout<<"Series Type:1+(1/4)+(1/8)+(1/12)+...(1/100)"<<endl;

 

    float num=0;

    for (float i=4; i<= 100; i=i+4)

    {

        num=num+(1/i);

    }

    num=num+1;

 

    cout<<"Total of series: "<< num;

    getch();

}

 

Output:

 clip_image002

f 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 10, 2017

C++ Code Review: Printing entered number into word

Description: This program spells or shows user entered number or integer in term of words.

Code:

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

//Program prints entered number in words.

 

#include<iostream>

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

#include<cstdlib> //for system()

 

using namespace std;

 

void once(int a)

{

   switch(a)

    {

    case 1:

        cout<<"One";

        break;

    case 2:

        cout<<"Two";

        break;

    case 3:

        cout<<"Three";

        break;

    case 4:

        cout<<"Four";

        break;

    case 5:

        cout<<"Five";

        break;

    case 6:

        cout<<"Six";

        break;

    case 7:

        cout<<"Seven";

        break;

    case 8:

        cout<<"Eight";

        break;

    case 9:

        cout<<"Nine";

        break;

    }

}

 

int tens(int a,int b)

{

    int flag=0;

    switch(a)

    {

    case 1:

        flag=1;

        switch(b)

        {

        case 0:

            cout<<"Ten";

            break;

        case 1:

            cout<<"Eleven";

            break;

        case 2:

            cout<<"Twelve";

            break;

        case 3:

            cout<<"Thirteen";

            break;

        case 4:

            cout<<"Fourteen";

            break;

        case 5:

            cout<<"Fifteen";

            break;

        case 6:

            cout<<"Sixteen";

            break;

        case 7:

            cout<<"Seventeen";

            break;

        case 8:

            cout<<"Eighteen";

            break;

        case 9:

            cout<<"Nineteen";

            break;

        }

        break;

    case 2:

        cout<<"Twenty";

        break;

    case 3:

        cout<<"Thirty";

        break;

    case 4:

        cout<<"Fourty";

        break;

    case 5:

        cout<<"Fifty";

        break;

    case 6:

        cout<<"Sixty";

        break;

    case 7:

        cout<<"Seventy";

        break;

    case 8:

        cout<<"Eighty";

        break;

    case 9:

        cout<<"Ninety";

        break;

    }

    return(flag);

}

 

void hundred(int a)

{

    switch(a)

    {

    case 1:

        cout<<"One Hundred";

        break;

    case 2:

        cout<<"Two Hundred";

        break;

    case 3:

        cout<<"Three Hundred";

        break;

    case 4:

        cout<<"Four Hundred";

        break;

    case 5:

        cout<<"Five Hundred";

        break;

    case 6:

        cout<<"Six Hundred";

        break;

    case 7:

        cout<<"Seven Hundred";

        break;

    case 8:

        cout<<"Eight Hundred";

        break;

    case 9:

        cout<<"Nine Hundred";

        break;

    }

}

 

int main()

{

     system("cls");//to clear the screen

    int n,a[3],i=0,flag=0;

    cout<<"Enter any number(max 3 digits):";

        cin>>n;

 

        while(n!=0)

    {

        a[i++]=n%10;

        n=n/10;

    }

 

    for(i=i-1; i>=0; --i)

    {

        if(i==0&&flag==0)

            once(a[0]);

        if(i==1)

            flag=tens(a[1],a[0]);

        if(i==2)

            hundred(a[2]);

        cout<<" ";

    }

    getch();

    return(0);

}

 

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.