Program of cascading, C/C++ Programming

Assignment Help:

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();

       }


Related Discussions:- Program of cascading

What does it mean to declare a function as a static, (c) A static member fu...

(c) A static member function can access static member data only, static member functions and functions and data outside the class. A static member function may be called, even whil

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

C program to read the contents of a file, Program is to read the contents o...

Program is to read the contents of a file: void main()    {   ifstream fin("ascii.txt");   char ch;   while(! fin.eof())     {   fin>>ch;   cout     }

Define multi file program, Define Multi File Program? While writing lar...

Define Multi File Program? While writing large programs we must divide programs up into modules. These would be separate source files and the main() function would be in one fi

Programming, I have a C++ programming assignment due on 8th January. As I a...

I have a C++ programming assignment due on 8th January. As I am out of country and cannot complete it, I would like to know how much fees would you charge to complete the assignmen

C program for change the case in title case, #include stdio.h> #include ...

#include stdio.h> #include conio.h> #include ctype.h> #include string.h>   void main() {           int i=0,j=0,length;           char a[30];           cl

Write a c program to compute the factorial, Write a C program to compute th...

Write a C program to compute the factorial of  5 i.e. 1x2x3x4x5 etc Write a C program to calculate the output Y for a given value of X for the following formula.       Y=X 2

Need a solution, Hello. I need a solution for this assignment. It is for C+...

Hello. I need a solution for this assignment. It is for C++ Language: Create a BusinessPartner class that contains a first name, company name, and a telephone number. Create a Con

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd