Posts

Showing posts from December, 2011

Evaluating A Postfix Expression Using Stack DataStructures

#include"stdafx.h" #include<math.h> #include<iostream> # define MAX_STACK 150  using namespace std; class stacks {    int value,item,top;    int stack[MAX_STACK];    public:       stacks()       {   top=(-1);       }       void push(float);       float pop(); }; void stacks::push(float value) {    if(top==MAX_STACK)    {       cout<<"Stack is full!\nOverflow!";          exit(0);    }    else    top++;    stack[top]=value; } float stacks::pop() {    if(top<0)    {       cout<<"Stack is empty!\nUnderflow!";       exit(0);    }    else    item=sta...
Using DateTime Object: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 {     class Program     {         static void Main( string [] args)         {             //1             //To get current Date And Time             DateTime DT = new DateTime ();             DT = DateTime .Now;             Console .WriteLine( "Current date is {0} " , DT.Date);             //2             //Initalize datetime object using overloads   ...

Tree Data Structure

// Mairaj.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; class node {           private :           int val;           node *right;           node *left; public :           void setvalue( int x)           {                    val=x;           }           int getvalue()           {                    return val;  ...