Home TechnologyComputers Subscribe to RSS

Which Statement Is Used For Input In C++ Language?

Answer Question

2 Answers - Sort by: Date | Rating

    The "cin" Object------Input Stream
    The "cin" stands for console input. It is pronounced as "See In". It is an input stream. It is used as input statement to get input from the keyboard during program execution.
    When an input statement is executed, the computer waits to receive an input from keyboard. When a value is typed and enter key is pressed, the value is assigned to the variable and control shifts to the next statement.
    The "cin" object is also a part of iostream header file.
    The syntax of "cin" is:
    Cin>> var1 [>>var2……..];
    Cin: It represents the object name used as an input stream. This stream represents data coming from input device keyboard.

    >>: It is extraction operator or get from operator. It gets an input from the input device and assigns it to the variable.
    Var1, var2: These represent list of variables. Each variable is separated by extraction operator ">>". Usually a separate statement is used for each variable.
    At least one variable on the right hand side of the ">>" operator must be used. The use of other variables is optional.
    For example, to input data into variables a, b, c, the input statement si written as
    Cin>> a>>b>>c;
    When this statement is executed,"Enter" key is pressed after typing data for each variable.
    0 0

    Pretty123 

    answered 3 years ago

      The standard input statement in C++ is cin.
      The structure of cin is

      cin>>obj;

      where obj can be any variable, any class object, any pointer.

      For example

      int a;
      cin>>a; //any value entered by user will be stored in a.
      0 0

      White 

      answered 3 years ago

        Answer Question - Answers are editable for 5 min.

        If you do not Sign-in or Register your answers will

        be anonymous, your answers may also be

        checked before going online.

        0

        More

           
           

          Ask a Question via Twitter

          Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

          Blurtit Store

          Get T-shirts, hoodies, caps and more at the Blurtit store

          Blurtit International