Wednesday, July 20, 2016

1st rank

Saturday, April 23, 2016

Monday, February 29, 2016

Sunday, February 14, 2016

To Show exception handling.
//Try block throwing exception
#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
    int a;
    int b;
    cout<<"Enter value of A and B"<<endl;
    cin>>a>>b;
    try
    {
        if(b==0)
            throw b;
        else
          cout<<"Result="<<(float)a/b<<endl;
    }
    catch(int i)
    {
        cout<<"Divide by zero exception: B="<<i<<endl;
    }
    cout<<"END"<<endl;
    getch();
    return 0;
}
Output:-
First Execution
Second Execution


 To sort 10 number in asscending order using function template.
Program:-

#include <iostream>
#include <conio.h>
using namespace std;
template <class T>
void Sort(T a[],int n)
{
    T hold;
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-1-i;j++)
        {
            if(a[j]>a[j+1])
            {
                hold=a[j];
                a[j]=a[j+1];
                a[j+1]=hold;
            }
        }
    }
}
int main()
{
    int i,j;
   int x[10]={1,8,7,4,6,7,4,2,5,7};
   float y[10]={0.2,0.5,1.1,2.1,0.33,5.6,9.7,1.59,8.8,0.001};
   Sort(x,10);
   Sort(y,10);
   cout<<"------Sorted X array-----------"<<endl;
   for(i=0;i<10;i++)
   {
       cout<<x[i]<<endl;
   }
   cout<<"------Sorted Y array-----------"<<endl;

       for(j=0;j<10;j++)
       {
          cout<<y[j]<<endl;
       }
       cout<<"!!!!!!!!!!!Thank You!!!!!!!!!!!"<<endl;
       getch();


    return 0;
}

Output:-







Monday, February 8, 2016

 //Adding two number using class template...
#include <iostream>
#include<conio.h>
using namespace std;
template <class T>
class mytemp
{
private:
    T a,b,c;
public:
    void getdata()
    {
        cout<<"Enter first number:";
        cin>>a;
        cout<<"Enter Second number:";
        cin>>b;
        cout<<endl;

    }
    void total()
    {
        c=a+b;
        cout<<"Total values is:"<<c<<endl;
        cout<<endl;

    }
};
int main()
{
    mytemp<int>obj1;
    mytemp<float>obj2;
    cout<<"Enter two integer:"<<endl;
    obj1.getdata();
    obj1.total();
    cout<<"Enter two float:"<<endl;
    obj2.getdata();
    obj2.total();
    cout<<"********Thank You********"<<endl;
    getch();
    return 0;
}

OutPut
 
// Program to Swap Two Numbers Using Function Template. 

#include <iostream>
#include<conio.h>>
using namespace std;
template <class T>
void Swap(T &n1, T &n2)
{
    T temp;
    temp = n1;
    n1 = n2;
    n2 = temp;
}

int main()
{
    int i1=8, i2=2;
    float f1=7.1, f2=5.2;
    char c1='I', c2='T';
    cout<<"Before Swaping data to function template."<<endl;
    cout<<"i1 = "<<i1<<"\ni2="<<i2;
    Swap(i1, i2);
    cout<<endl<<"After swaping data to function template."<<endl;
    cout<<"i1 = "<<i1<<"\ni2="<<i2;

    cout<<endl<<"Before swaping data to function template."<<endl;
    cout<<"\nf1 = "<<f1<<"\nf2="<<f2;
    Swap(f1, f2);
    cout<<endl<<"After swaping data to function template."<<endl;
    cout<<"\nf1 = "<<f1<<"\nf2="<<f2;

    cout<<endl<<"Before swaping data to function template."<<endl;
    cout<<"\nc1 = "<<c1<<"\nc2="<<c2;
    Swap(c1, c2);
    cout<<endl<<"After swaping data to function template."<<endl;
    cout<<"\nc1 = "<<c1<<"\nc2="<<c2;
    getch();
    return 0;
}


OutPut
 


Sunday, February 7, 2016



  Features of system theory

1) Goal-direct:
            A system is goal direct.it exists to achieve some target.
2) Sub system:
            The part of the system are subsystem.
           All the subsystem are related each other.
           They interact with each other.
3) Open or Close
            A system can open or close.
            Close system has no environment.
            Open system interact with the environment,
            Management is an open system. It responds to environmental changes.
4) Synergy:
            System thinks means that the whole is greater than the sum of its part.
            2+2=5
            It leads to synergy.
5) Boundary:
            Every system has a boundary that separates it form the environment.
            open system has flexible boundary.
6) Flow:
   A system has flow of information.
   They enter as inputs from environment.   
  They undergo transformation processes within the system.
       They go back to environment as outputs.
7) Feedback:
  It is getting information about actual performance.
  It is  the key to system control.
8) Entropy:
         It is the process of system decline.
     When organization fail to make corrections based on environmental feedback.

 ADVANTAGES OF THE SYSTEMS THEORY
  1.   It focuses on the environment and how changes can impact the organization.
  2.   Broadens the theoretical aspects for viewing the behavior of organizations.
  3.  It is designed to deal with complex tasks.
  4.  Takes an integrative total view of organization.
  5.  It is useful for studying complex organization.
  6.   Feedback facilitates changes in the system
  DISADVANTAGES OF THE SYSTEMS THEORY
  1.  The systems theory doesn’t focus on specific task functions.
  2.  Doesn’t provide for detailed focus.
  3. The theory changes in environment directly affect the structure and function of the organization.
  4.   Doesn’t directly explore the impact of interpersonal relationships and loyalty on productively.
  5. The systems theory is complex for practical application.
  6.   In small organization, it is not relevant.
  7.  The theory is too abstract

Saturday, February 6, 2016


// Run time polymorphism




 #include<iostream>
#include<conio.h>
     using namespace std;
     class media{
           protected:
            char title[50];

            char pub[50];
  public:
    virtual    void read()=0;
      virtual void show()=0;

};
    class book:public media {
        private:
              int pages;
        public:
            void read(){
                cout<<"Book details"<<endl;
                cin>>title;
                cin>>pub;
                cin>>pages;
            }
            void show(){
                cout<<"Title"<<title;
                cout<<"Publication"<<pub;
                cout<<"Pages"<<pages;
            }

    };

      class tape:public media {
            int time;
            public:
                    void read(){
                        cout<<"Tape details"<<endl;
                cin>>title;
                cin>>pub;
                cin>>time;
            }

void show(){
                cout<<"Title"<<title;
                cout<<"Publication"<<pub;
                cout<<"Time"<<time;
            }

    };
int main(){
        media *m;

        book b;
        tape t;
        m=&b;
        m->read();
        m->show();
        m=&t;
        m->read();
        m->show();
        getch();
        return 0;
}






//Virtual Base Class


#include <iostream>
#include<conio.h>
using namespace std;
class person
{
protected:
    char name[20];
    int age;
public:
    void getdata()
    {
        cout<<"Enter name and age"<<endl;
        cin>>name>>age;
    }
    void display()
    {
        cout<<"Name::"<<name<<endl;
        cout<<"Age::"<<age<<endl;
    }

};


class Employee: virtual public person
    {
    protected:
        int eid,salary;
        public:
        void getdata()
        {
            cout<<"Enter Emp id and salary"<<endl;
            cin>>eid>>salary;
        }
        void display()
        {
            cout<<"Emp ID::"<<eid<<endl;
            cout<<"Salary::"<<salary<<endl;
        }
    };
class student: virtual public person
{
    protected:
    int sid;
    char faculty[10];
public:
    void getdata()
    {
        cout<<"Enter student ID and faculty"<<endl;
        cin>>sid>>faculty;

    }
    void display()
    {
        cout<<"student ID:"<<sid<<endl;
        cout<<"Faculty::"<<faculty<<endl;
    }
};

class TA: public Employee, public student
{
    char course[10];
public:
    void getdata()
    {
        person::getdata();
        Employee::getdata();
        student::getdata();
        cout<<"Enter Course"<<endl;
        cin>>course;
    }
    void displaydata()
    {
        person::display();
        Employee::display();
        student::display();
        cout<<"course::"<<course;
    }
};

int main()
{
    TA ta;
    ta.getdata();

    cout<<"----------------TechingAssistant Details-----------------"<<endl;
    cout<<"***************************************************"<<endl;
    ta.displaydata();
    getch();

    return 0;
}




Output


 







Friday, February 5, 2016



Form of inheritance
A class can inherit properties from one or more classes and from one or more levels.
On the basis of this concept, there are five forms of inheritance. 
  1.    Single inheritance
  2.    Multiple inheritance
  3.    Hierarchical inheritance
  4.    Multilevel inheritance
  5.    Hybrid inheritance

    2)      Multiple inheritance
     In this inheritance, a class is derived from more than one base class. The example and figure below show this inheritance.
     Example:-
    #include <iostream>
    #include<conio.h>
    using namespace std;
    class Teacher
        {
            int tid;
            char subject[20];
            public:
            void getTeacher()
            {
                cout<<"Enter Teacher id and subject"<<endl;
                cin>>tid>>subject;
            }
            void displayTeacher()
            {
                cout<<"Teacher ID::"<<tid<<endl;
                cout<<"Subject::"<<subject<<endl;
            }
        };
    class staff
    {
        int sid;
        char level[10];
    public:
        void getStaff()
        {
            cout<<"Enter staff ID and level"<<endl;
            cin>>sid>>level;

        }
        void displaystaff()
        {
            cout<<"Staff ID:"<<sid<<endl;
            cout<<"Level::"<<level<<endl;
        }
    };

    class coordinator: public Teacher, public staff
    {
        char program[10];
    public:
        void getdata()
        {
            getTeacher();
            getStaff();
            cout<<"Enter Program"<<endl;
            cin>>program;
        }
        void displaydata()
        {
            displayTeacher();
            displaystaff();
            cout<<"Program::"<<program;
        }
    };

    int main()
    {
        coordinator c;
        c.getdata();
        cout<<"----------------coordinator Details-----------------"<<endl;
        cout<<"***************************************************"<<endl;
        c.displaydata();
        getch();

        return 0;
    }

    Output:-










     




Translate

Sample Text

Powered by Blogger.

Every thing is possible in real world....

Contact us

Name

Email *

Message *

IT Support

Blogroll

You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "

Video

Our Facebook Page

Popular Posts

Total Pageviews