Page 38 - Modular_V1.1_Flipbook
P. 38

Multiple-line Comment

                  C++ allows the user to add multiline comments by using the /* and */. To add a multiple line
                  comment:
                  void main(){
                  /*  int age;
                        cout<<”Hello from C++.”;
                        //Printing a message.                 */
                  }
                  Now, if you run the preceding code nothing will be printed. Because every line of the code is

                  commented.
                      Recap



                          The cout object is used to display the output on the output device connected to the computer
                         like monitor.
                          The cin object is used to take the input from the user through keyboard.
                          Escape sequence characters are used to represent certain special characters which cannot be
                         printed directly on the output screen.
                          Comments in C++ are used to explain parts of the code.





                                                         Exercise



                  A.   Tick (3) the correct option.
                       1.  Which of the following is the Standard Output Stream?

                           a.  cout                                         c.  both a and b
                           b.  cin                                         d.  none of these

                       2.  Which symbol represents the stream insertion operator?
                           a.  <<                                           c.  /* and */
                           b.  >>                                          d.  //

                       3.  Which of the following symbols is used to represent extraction operator?
                           a.  &&                                           c.  <<
                           b.  //                                          d.  >>

                       4.  How many words can you take as string by using the cin object?
                           a.  1                                            c.  2
                           b.  3                                           d.  5

                       5.  Which of the following escape sequence characters is used to add double quotes?
                           a.  /”                                           c.  \”
                           b.  \n                                          d.  \\”




                  36      Touchpad MODULAR (Version 1.1)-X
   33   34   35   36   37   38   39   40   41   42   43