Showing posts with label CPP. Show all posts
Showing posts with label CPP. Show all posts

Monday, 14 May 2012

[Book] Programming ANSI C++ by Bhusan Trivedi

0 comments
buy ANSI C++ by bhusan trivedi at lowest price

Programming with ANSI C+ + Book Description


Designed to serve as a textbook for undergraduate engineering, BCA, and MCA students, Programing with ANSI C++ provides an in-depth coverage of elementary as well as advanced topics of the language. The book starts with a philosophical background and an overview of C++ followed by a systematic discussion of concepts such as classes, objects, functions, constructors, destructors, overloading, standard template library, and templates. An in-depth discussion of topics such as exception handling, in heritance, polymorphism, RTTI, file handling, and namespaces has been presented with suitable examples. To reinforce the understanding of concepts, diagrams and program listings have been included wherever appropriate. The theory is well supported with plenty of application-oriented programs, complete with their source codes and test cases, and exercises in each chapter.

Table of Contents


  • Preface
  • Introduction to C++
  • Overview of the C++ Language
  • Classes and Objects
  • Functions
  • Constructors and Destructors
  • Operator Overloading and User Defined Conversions
  • Templates
  • Exception Handling
  • Inheritance
  • Runtime Polymorphism by Virtual Functions
  • Run Time Type Information and Different Casting Operators
  • Streams and Formatted IO
  • Using Files for IO
  • Namespaces
  • ANSI String Objects
  • Standard Template Library
  • Appendix: Case Study
  • Index

About the Author :


Bhushan Trivedi has contributed to Programming with ANSI C+ + as an author. Bhusan Trivedi, currently a faculty member at GLS Institute of Computer Technology, Ahmedabad, has about 20 years experience in teaching postgraduate students of computer applications. During the course of his career, the author has taught papers on C++, C, Data Structures, Computer Networks, DBMS, and Artificial Intelligence. Having also held the prestigious position of the Director of Gujarat Vidyapith, he has been involved in formulating rules for entrance to MCA as also revising syllabi for various courses offered in MCA.

Buy This Book at 19% Discount ( Only in Rs.  255 )





 
 
Buy This Book in Free Cash on Delivery

Why Buy from iAmLearningHere ?


Before reading this , i am sure you must have inquired this book on any book stall, you find this book in Rs. 315 in your local book stall. you have to go there to buy book. but by ordering from here you get this book at your door in only Rs. 255 (No shipping or No courier charges). so why should not buy from here?
You have to pay only Rs. 255 only at delivery time, No Advance Payment, No Risk

Thursday, 29 March 2012

Queue Implementation using Array

0 comments

Write a program to perform the following operation on a simple queue ( using Array )
    a.    Insert an element
    b.    Remove an element
    c.    Display
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>

class Queue
{
    int *que, F, R;
    int size;
public :
    Queue(int s)
    {
        F = R = -1;
        size = s;
        que = new int[size];
    }
    void insertElement(int); // insert element fucntion
    void display();
    void delElement();
};

void Queue :: insertElement(int element)
{
    if(R == (size - 1))
        cout<<endl<<"Queue is Full"<<endl;
    else
    {
        if(F == -1 )
            F = 0;
        R++;
        que[R] = element;
    }
}

void Queue :: delElement()
{
    if(F  == -1)
        cout<<endl<<"Queue is Empty";
    else
    {
        if(F == R)
        {
            F = R = -1;
        }
        else
        {
            int element = que[F];
            F++;
            cout<<endl<<"Deleted Element is : "<<element<<endl;
        }
    }
}
void Queue :: display()
{
    cout<<endl<<"\t\t\t";

    for(int i = F; i <= R; i++)
    {
        cout<<que[i]<<"  ";
    }
    cout<<endl;
}


void main()
{

    int ch, element, size;

    clrscr();
    cout<<endl<<"Queue OPERATION";

    cout<<endl<<"Enter Size for Queue: ";
    cin>>size;

    Queue q(size);        //object of queue class

    while(1)
    {

    cout<<endl<<" 1. Insert";
    cout<<endl<<" 2. delete";
    cout<<endl<<" 3. Exit"<<endl;
    cin>>ch;

    switch(ch)
    {
        case 1:
            cout<<endl<<"Enter Element: ";
            cin>>element;

            q.insertElement(element);

            q.display();
            break;
        case 2: q.delElement();
            q.display();
            break;
        case 3:
            exit(0);
        default:
            cout<<endl<<"wrong choice"<<endl;
    }

    }

getch();
}

Monday, 26 March 2012

Stack implementation using Linked List

0 comments

1.    Write a program to perform the following operations on a stack.(using Linked List)
    a.    PUSH   
    b.    POP
    c.    ISEMPTY
    d.    ISFULL
    e.    PEEP
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class node
{
    int data;    //data part of node
    node *link;  // link part points to next node
public:
    node()       // constructor that set NULL to link
    {
        link = NULL;
    }

//below are functions to get/set the private members
    int getData()
    {
        return data;
    }
    void setData(int d)
    {
        data = d;
    }
    node* getLink()
    {
        return link;
    }
    void setLink(node *nnode)
    {
        link = nnode;
    }
};

// stack class
class StackLL
{
    node *top;
public:
    StackLL()// set top to NULL
    {
        top = NULL;
    }
    void push(int);
    void pop();
    void peep();
    int isEmpty();
    void display();
};

//member function's body

void StackLL :: push(int element)
{
    node *nnode;
    nnode = new node;
    nnode->setData(element);
    if(isEmpty())
    {
        top = nnode;
    }
    else
    {
        nnode->setLink(top);
        top=nnode;
    }
}
int StackLL :: isEmpty()
{
    if(top == NULL)
        return 1;
    else
        return 0;
}

void StackLL :: pop()
{
    node *ptr;
    if(isEmpty())
    {
        cout<<endl<<"Stack Underflow";
    }
    else
    {
        ptr = top;
        top = top->getLink();
        delete(ptr);
    }
}

void StackLL :: display()
{
    node *ptr;
    cout<<endl<<"\t\t\t";
    for(ptr = top; ptr!=NULL; ptr=ptr->getLink())
    {
        cout<<ptr->getData()<<endl<<endl<<"\t\t\t";
    }
}


void main()
{
    int element, ch;
    clrscr();
    cout<<endl<<"\tStack Operation using LinkedList";
    StackLL stk;

    while(1)
    {
    cout<<endl<<" 1. Insert";
    cout<<endl<<" 2. delete";
    cout<<endl<<" 3. Exit"<<endl;

    cin>>ch;
    clrscr();
    cout<<endl<<"\t\t\tStack Operation using LinkedList"<<endl;

    switch(ch)
    {
        case 1:
            cout<<endl<<"Enter data: ";
            cin>>element;

            stk.push(element);

            stk.display();
            break;
        case 2: stk.pop();
            stk.display();
            break;
        case 3:
            exit(0);
        default:
            cout<<endl<<"wrong choice"<<endl;
    }

 }
getch();
}

Sunday, 18 March 2012

Stack implementaion using Array in CPP

1 comments

Definition : Stack is linear Data Structure, it is a collection of homogeneous data elements where insertion and deletion operation take place at one end only(TOP).

Operation on stack:
  • PUSH   :   insertion into stack
  • POP      :   deletion in stack
  • PEEP    :   display the last ( TOP )  element
Write a program to perform the following operations on a stack using Array (CPP).
    a.    PUSH   
    b.    POP
    c.    ISEMPTY
    d.    ISFULL
    e.    PEEP

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define N 5

class Stack
{
    int sArr[N];     //stack array
    int top;
public:
    Stack()      //constructor to initialize top
    {
        top=-1;
    }

    void push(int);
    void pop();
    int isEmpty();
    int isFull();
    void peep();
    void display();
};
void Stack :: push(int element)
{
    if(isFull())
    {
        cout<<"\n Stack OverFlow";
    }
    else
    {
        top++;
        sArr[top]=element;
    }
}
void Stack :: pop()
{
    if(isEmpty())
    {
        cout<<"\n Stack UnderFlow";
    }
    else
    {
        cout<<endl<<"Deleted Element is: "<<sArr[top];
        sArr[top]=NULL;
        top--;
    }
}

int Stack :: isEmpty()
{
    if(top<0)
        return 1;
    else
        return 0;
}
int Stack :: isFull()
{
    if(top == N-1)
        return 1;
    else
        return 0;
}

void Stack :: peep()
{
    if(isEmpty())
        cout<<"\n Stack is EMPTY";
    else
        cout<<"\nTOP ELEMENT IS:  "<<sArr[top];
}
void Stack :: display()
{
    cout<<endl<<"\t\t\t";
    for(int i=top ; i >= 0 ; i--)
    {
        cout<<sArr[i]<<endl<<endl<<"\t\t\t";
    }
}


void main()
{
    Stack s;  //object creation
    int ch, data;
    clrscr();
    cout<<"\n\n STACK OPERATIONS";

    while(1)
    {

    cout<<"\n\n1. PUSH";
    cout<<"\n2. POP";
    cout<<"\n3. PEEP";
    cout<<"\n4. EXIT";
    cout<<"\nEnter Choice: ";
    cin>>ch;
    clrscr();
        cout<<"\n\n STACK OPERATIONS\n\n";

        switch(ch)
        {
        case 1:
            cout<<"\n Enter Value: ";
            cin>>data;

            s.push(data);
            s.display();
            break;
        case 2: s.pop();
            s.display();
            break;
        case 3: s.peep();
            break;
        case 4: exit(0);
            break;
        }
    }
getch();
}
 

Recent Post

Recent Comments

© 2010 IamLearningHere Template by MBT