What is the "/n" meaning in the c++. how and where i can use "/n". And also want to know what is the correct syntax on "/n".
- Login or Signup Now to post comments
What is the "/n" meaning in the c++. how and where i can use "/n". And also want to know what is the correct syntax on "/n".
Hi Rebeca,
‘/n’ in c++ is a constant meaning "newline"
It can be used when you want to break a sentence so that the next word starts in a new paragraph i.e new line. Something to know about \n is that it does not flush the output bufferBelow is an example of how you can use it while writing your code:
#include <iostream> int main(void) { std::cout <<"Testing 1" <<std::endl; std::cout <<"Testing 2\n"; } /* * Program output: Testing 1 Testing 2 * */I hope this helps you :)
Hi Rebecca
The meaning of "/n" in C++ is a NewLine Character Ie It Causes the next lot of output to start on the next line down
This applies to output to printer,or screen Example printf ("Some sort of string of chars /n/n A new line of Characters to print or display )
Will Display/print as follows
Some sort of string of chars
A new line of Characters to print or display
Syntax Print/Printf/( ...../n ...) or any function that send optput to the screen or printing device
Can be used on it own or in conjunction with any printable or displayable data and as many time as required
Bruce
Hi Rebecca
TIn C++ the "/n" is the Newline or Carrage Return Character
When you output data and include the "/n" It instructs the cursor or printer to move to the beginning of the next line
Example
void main
[ stdout ""your first line "
stdout " your second l/n and third line"
}
output
your First line
your second line
and third line
The about applies to all functions that display or print output ie printf, print etc
I hope this is helpful
Eaan Rickchard