Cin and Cout in C++


      Standard output stream(Cout)
-The pre-defined object Cout is an instance of ostream class. The Cout object is said to be connected to the standard output device, which usually displays on the screen. It is written by string keyboard ‘Cout’ followed by an insertion operator. It is followed by the massage in the double Quotations mark(“  “) & the value to be display on the screen and also set the semicolon ( ; ) at the end.

                            For example
                                                        #include<iostream.h>
                                                        #include<conio.h>
                                                            int main ()
                                                                     {
                                                          cout<<”hello world”;
                                                           getch ();
                                                          return 0;
                                                                }

Standard input device(Cin)
The pre-defined object Cin is an instance of istream class. The Cin object is said to be connected to the standard input device usually in the keyboard. It is written by the keyboard followed by extraction operation( >>)   followed by the data in the inverted comma( “    “) then followed by a semicolon( ; ) at last.
Its syntax is given below:- 
                          {
                              Cin>>input;
                           }
Its example:
                          #include<iostream.h>
                          #include<conio.h>
                                  Int main ()
                                        {
                                    int a;
                                     cout<<”enter the number”;
                                     cin>>a;
                                    getch ();
                                   return 0;
                                       }

No comments:

Post a Comment

theengineerschoice01@gmail.com