Search This Blog

Tuesday, April 19, 2016

Converting Infix to Postfix code - in C++


#include

#include
#include
#include
using namespace std;

class infix_to_postfix
{

protected:
    string exp;
    string infixexp;
    stack charstack;

    bool prcd(char a, char b)
    {
        return a > b;
    }

   public:
            infix_to_postfix(string str)
            {
                 exp = str;
            }

            void push_to_stack()
            {
                  for(int i = 0; exp[i]; ++i)
                  {
                         if(exp[i] == ' ')
                             continue;

                   if(isalnum(exp[i]))
                   {
                         infixexp += exp[i];
                   }

             else
             {
                      while(!charstack.empty() && prcd(exp[i], charstack.top()))
                      {
                              infixexp += charstack.top();
                               charstack.pop();
                      }

                              charstack.push(exp[i]);
             }
        }

        while(!charstack.empty())
        {
            infixexp += charstack.top();
            charstack.pop();
        }
    }

    string print()
    {
        return infixexp;
    }


   
};

class evaluate {
public:
    evaluate(string str)
    {
        exp = str;
    }

    void peform()
    {
        int res;

        for(int i = 0; i < exp.length(); i++)
        {
            if(isalnum(exp[i]))
            {
                nums.push(exp[i] - '0');
            }
            else
            {
                if(!nums.empty())
                {
                    int a = nums.top();
                    nums.pop();
                    int b = nums.top();
                    nums.pop();

                    res = doit(b, exp[i], a);
                }
                nums.push(res);
            }
        }
    }

    int retres()
    {
        return nums.top();
    }

protected:
    string exp;
    stack nums;

private:
    int doit(int a, char c, int b)
    {
        switch(c)
        {
        case '+':
            return a + b;
            break;

        case '-':
            return a - b;
            break;

        case '*':
            return a * b;
            break;

        case '/':
            return a / b;
            break;
        }
    }
};

int main()
{
    string infixstr;
    infix_to_postfix itop("5 * 2 + 3 * 1 - 9");

    itop.push_to_stack();
    infixstr = itop.print();

    cout << infixstr << endl;

    evaluate ev(infixstr);
    ev.peform();

    int res = ev.retres();

    cout << res << endl;

    return 0;
}

Josephus Problem Solvation code in C++

#include
using namespace std;

struct node{

    int val;
    node *next;
};

void insert_node(int);
void print();
void josephus(int);
node *head,*nptr,*tptr;

int main(){

    head = NULL;
    int start,n;
    cout << "Enter node number: " << endl;
    cin >> n;
    insert_node(n);
    cout << "The persons are:" << endl;
    print();
    cout << "Enter start number: " << endl;
    cin >> start;
    josephus(start);
    return 0;
}

void josephus(int start){

    node *ptr,*qptr;
    qptr = ptr = head;
    for (int i = 1; i < start; i++){

            ptr = ptr->next;
            qptr = ptr;
    }
    while (ptr->next != ptr){

        qptr->next = ptr->next->next;
        ptr = qptr->next;
        qptr = ptr;
    }
    head =  ptr;
    cout << "The person survived is :" << ptr->val << endl;
}
void insert_node (int n){

    for(int i = 0; i < n; i++){

        nptr = new node;
        nptr->val = i+1;
        nptr->next = NULL;
        if (head == NULL){

            head = nptr;
            tptr = nptr;
        }
        else{

            tptr->next = nptr;
            tptr = nptr;
        }
    }
    tptr->next = head;
}
void print(){

    tptr = head;
    cout << tptr->val << "->";
    tptr = tptr->next;
    while (head != tptr){

        cout << tptr->val << "->";
        tptr = tptr->next;
    }
    cout<< endl;
}

Operations Management Banner



     My made Operations Managements Banner by Adobe Illustrator CS





Sunday, April 17, 2016

Get back your sent Mail instantly and sent undo in Gmail .

You sand a mail to some one but after sent the mail you think there is some thing wrong in your mail. But you have nothing to do . But this time you can UNDO your sent mail instantly . Here the sequence are given to enable UNDO sent mail .
1. Go to Setting
2. Enable Undo send with 10 second .
3. Click Save Change button . 


Now you can see UNDO after sent every mail .When you was "Your message has been sent " .

Thank you .

Wednesday, April 6, 2016

I was a Trainer at Microsoft A2I Program at Gopalganj .

I was a trainer in Microsoft A2I  program at Gopalganj DC office at 30 to 31 March 2016 . There was almost 45 women union Digital shop organizer in  hall . The Deputy Commissionaire of Gopalganj Distric was the chief guest . I am and one of my brother take two days log training of these  women's about Microsoft product ,basic computer knowledge , troubleshooting ,internet using and many other motivational task . And after all we took a exam from our training period and give all women Certificates . Really this two days was a big experience of my life .

Here I share some photos of training secession .


                           

                         




Cricket Score Keeper a Android apk .

I just 80% complete my first android application . It's about Cricket Scoring .You can score a full Cricket match by this application .There are a lot of button for scoring , you have to use this button for scoring . And use your common seance .
It is updating day by day .

Thank You
 
                                                                  Download

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...