Basic Input and Output Using in C++


The statement shows cout followed by the insertion operator << using insert data into the output stream, and the endl pronounced "standard end-line".

The usage of cin is simple, used for input. It is accompanied by the variable you want to be storing the input data in. Using the extraction operator >> (extracts data from the input stream).

The variable inputNumber is declared to store data of type int. 
The variable inputName is declared to store data of type string.

What does #include do? 
- This is a directive to the preprocessor that runs when you call your compiler. This specific directive causes the contents of the file named in <> after #include to be inserted at that line as if it were typed at that location in your source code.

What is the difference between // comments and /* comments? 
- The double-slash comments (//) expire at the end of the line. Slash-star (/*) c omments are in effect until there is a closing comment mark (*/). The doubleslash comments are also referred to as single-line comments, and the slash-star comments are often referred to as multiline comments. Remember, not even the end of the function terminates a slash-star comment; you must put in the closing c omment mark or you will receive a compile-time error.

Basic Input and Output Using in C++

No comments:

Post a Comment