Forum

Extraction and Insertion operators in C++

This thread contains 1 reply, has 2 voices, and was last updated by Test 4 years, 5 months ago.

  • Author Replies
    • #63148

      What are the Extraction and Insertion operators in C++? Explain with examples.


    • #63149

      In the iostream.h library of C++, cin, and cout are the two data streams that are used for input and output respectively. Cout is normally directed to the screen and cin is assigned to the keyboard.

      cin(extraction operator): By using overloaded operator >> with cin stream, C++ handles the standard input.

      Example:
      int age;
      cin>>age;

      As shown in the above example, an integer variable ‘age’ is declared and then it waits for cin (keyboard) to enter the data. cin processes the input only when the RETURN key is pressed.

      cout (insertion operator): This is used in conjunction with the overloaded << operator. It directs the data that followed it into the cout stream.

      Example:
      cout<<” Hello, World!”;
      cout<<123;


Viewing 1 reply thread

You must be to reply to this thread.Please or . Registration is 100% free.

GET FREE CONSULTATION

Call Us Now For Free Consultation97370 05566

Our experts listen to you patiently and suggest you the right course after conducting a personality profile test. Register your interest below to schedule personality profile test for you.

SUBSCRIBE TO OUR NEWSLETTER

Copyright 2016-2024 Smart Mentors. All Rights Reserved.

Login

FORGOT PASSWORD

Sign up now to Become An Instructor

    Register your Interest

      cf7captchaRegenerate Captcha