Program of cascading, C/C++ Programming

Program of cascading:

class vector{

                private :

                int v[3];

 

                public:

                friend istream & operator >> (istream & ,vector &);//overloading the

                                                                                                                //insertion operator

                                                                                                                // for the vector type object

                friend ostream & operator << (ostream & ,vector &);

                friend vector operator * (vector,int);

                friend vector operator * (int ,vector);

 

                void show();

 

                 }; // class termination

 

                 istream & operator >>(istream &din ,vector & b )

                                {

                                for( int i=0;i<3;i++)

                                                {

                                                cout<<"enter "<

                                                din >> b.v[i];

                                                }

                                  return din;//for cascading

                                }

                   ostream & operator <<(ostream &dout ,vector & b )

                                {

                                for( int i=0;i<3;i++)

                                                {

                                                dout << b.v[i]<<"\n";

                                                }

                                  return dout; //for cascading

                                }

 

 

       vector operator *(vector a,int b)//function overloading

                                {          vector c;

                                                for(int i=0;i<3;i++)

                                                                c.v[i]=b*a.v[i];

                                  return c;

                                  }

 

                vector operator *(int a,vector b)

                                {

                                vector c;

                                                for(int i=0;i<3;i++)

                                                                c.v[i]=a*b.v[i];

                                  return c;

 

                       }

                void vector ::show()

                {

                                 for (int i=0;i<3;i++)

                                                cout << "\n"<

                                 }

 

                void main()

                {

                vector a,b,c;

                clrscr();

 

                cin>>b;//calling function cin is 1st argument and b other

                cout << b;

                a=b*10;

                c=20*b;

/*           b.show();

                a.show();

                c.show();*/

                cout<

                cout<

                getch();

       }

Posted Date: 10/18/2012 6:32:46 AM | Location : United States







Related Discussions:- Program of cascading, Assignment Help, Ask Question on Program of cascading, Get Answer, Expert's Help, Program of cascading Discussions

Write discussion on Program of cascading
Your posts are moderated
Related Questions
Project Description: We are aiming to prepare an industry first in the m-commerce world. M-commerce payment processing programmers required Skills required are C Programmi

#include #include #include void* memorycopy (void *des, const void *src, size_t count) {   size_t n = (count + 7) / 8;   char* destination = (char *) des;   char* source =

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

T o k e n :  Tokens  are  small  entities  in  a  program.    Example: identifiers,  keywords,  constants, operators, strings, etc.  These tokens are used almost in same wa

Write algorithm and program for the conversion of a Tree to a Binary Tree

Pointer Arithmetic We can manipulate the pointers too. We can perform operations such as addition, subtraction, increment and decrement etc.,. As the pointer variables have add

Identify 2 to 3 existing algorithms commonly used for object tracking. Algorithms should be in C or written in MATLAB language. Document these algorithms in flowcharts and run thes

Differentiate between a template class and class template in C++? Ans) Template class: A generic definition or a parameterized class not instantiated until the client gives the

There are 25 employees in a business. Each employee has 5 sales each day of the month (Assume there are 30 days in each month of the year). Draw a flowchart for a pr