Results 1 to 5 of 5

Thread: What is Input Output Operator in C++?

  1. #1
    Join Date
    Dec 2010
    Posts
    19

    What is Input Output Operator in C++?

    Hey friends, I wanted to know what does the term Input and Output Operator means in C++? I tried to understand this there but I get confused between cin and cout? Which is for input and which is for output? I am not able to get it. If anyone is having any knowledge or information about this query than please let know as soon as possible. I think that it may be for input and output process but still i am not sure. Can anybody let me know whether i am right or wrong?

  2. #2
    Join Date
    Apr 2009
    Posts
    488

    Re: What is Input Output Operator in C++?

    C++ performs input and output operation by means of cin and cout statements. These statements uses two operators .These operators are known as input and output operator. << is known as output operator formally known as the insertion operator. This operator is overloaded operator. It directs the contents of variable on its right hand side to the object on its left. The general syntax is
    cout<<variable;

  3. #3
    Join Date
    Apr 2009
    Posts
    569

    Re: What is Input Output Operator in C++?

    For example

    int a=10;
    cout<< a;
    In the above statement it directs the value of variable a to cout which sends it to display device.

    cout <<can be used to display strings on the screen as

    cout<<”hi how are you”;

    This is the perfect example of cout in C++ where you will find that whatever you write in output will appear as message in your output. You must know that there is one output and one input operator in every programming language where in it could read and display the objects.

  4. #4
    Join Date
    May 2009
    Posts
    637

    Re: What is Input Output Operator in C++?

    The input operator allows a user to type in a value from the keyboard and places it in the variable. cin identifier is predefined object in c++ representing standard input stream i.e. keyboard. >> is known as input operator formally known as extraction operator. It gets a value from the keyboard and assign it to the variable on its left.
    The general syntax is

    cin >> variable;

    For example
    cin >> a;

  5. #5
    Join Date
    May 2009
    Posts
    511

    Re: What is Input Output Operator in C++?

    C++ performs the input and output operation by mean of cin and cout. These are the two objects of the predefined classes which are in header file iostream.h.So to perform the input output operation one has to include the iostream h header file in the program. cin uses the input operator << where as cout uses the output operator >>. Cin is a object which receives input from the keyboard and store the input given by the user in the variable defined by user. Where as cout it retrieves the value of the variable and display it on screen.
    cin and cout are the two streams.
    The general syntax for cin is as.

    cin>> var1>>var2….;

    The cin statement accepts the input from the user and store it in a variable which is on the right hand side.

    The general syntax for cout is as.

    cout<< var1<<var2….;
    The cout statement retrieves data from the variable which is on the right hand side and display it on the screen.

Similar Threads

  1. Input /Output error while using SanDisk USB Flash Drive
    By Mayoor in forum Portable Devices
    Replies: 5
    Last Post: 07-09-2011, 10:39 PM
  2. Input and output arguments in java
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 09-03-2010, 12:32 PM
  3. Exception in java input/output
    By Aaliya Seth in forum Software Development
    Replies: 5
    Last Post: 22-01-2010, 12:05 PM
  4. How to Optimize memory or ram: input / output
    By fumble in forum Tips & Tweaks
    Replies: 0
    Last Post: 21-01-2009, 07:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,272,792.18127 seconds with 17 queries