C++ tutorial for beginners in telugu
The endl function ends the current line and starts a new line. In that way, it is much like the ‘n’ character. However, endl also flushes the output stream. When outputting text to a screen or a file in C++, data is fed into an output stream connected to the file or screen. Just because the data is in the stream, you cannot guarantee it has been written to the screen or the file. The endl function is one way to guarantee the text in that stream has been flushed.
The varying line-ending characters don’t matter, assuming the file is open in text mode, which is what you get unless you ask for binary. The compiled program will write out the correct thing for the system compiled for.
The only difference is that std::endl flushes the output buffer, and ‘n’ doesn’t. If you don’t want the buffer flushed frequently, use ‘n’. If you do (for example, if you want to get all the output, and the program is unstable), use std::end
Constants
The difference between variables and constants is that variables can change their value at any time but constants can never change their value. (The constants value is locked for the duration of the program.)
Constants can be very useful, PI for instance is a good example to declare as a constant.
Defining a constants
With the pre-processor directive “define” it is possible to define your own constants.
The format of the pre-processor directive #define is:
scape codes
Escape codes are used to represent characters that are difficult to express otherwise in the source code.
For instance a tab (t). Escape codes all start with a backslash ().
n |
Newline |
r |
carriage |
t |
Tab |
v |
vertical |
b |
Backspace |
f |
form feed |
a |
alert |
’ | single quote (‘) |
” | double quote (“) |
? | question mark (?) |
backslash () |
More Stories
Notice: Trying to access array offset on value of type bool in /hermes/bosnacweb05/bosnacweb05bi/b2282/ipg.jbbuidtech37209/timecomputers/wp-content/themes/enternews/inc/template-functions.php on line 601
C++ video tutorials in telugu about comment Part 4
Notice: Trying to access array offset on value of type bool in /hermes/bosnacweb05/bosnacweb05bi/b2282/ipg.jbbuidtech37209/timecomputers/wp-content/themes/enternews/inc/template-functions.php on line 601
C++ tutorial in telugu using cin Part 3
Notice: Trying to access array offset on value of type bool in /hermes/bosnacweb05/bosnacweb05bi/b2282/ipg.jbbuidtech37209/timecomputers/wp-content/themes/enternews/inc/template-functions.php on line 601
C++ language tutorial in telugu Part 2