What does '\r' and '\b' mean? Please explain with example.
Answers were Sorted based on User's Feedback
Answer / ankita
\r is known as carriage return
e.g printf("ABC\rDE");
ABC.
then becoz of \r cursor comes back to the 1st char i.e here
A after that DE is there then finally it print
DEC with cursor on C.
\b is known as back literal
e.g. printf("ABC\bDE");
then ABC then finally ABDE will get printed.
Is This Answer Correct ? | 63 Yes | 27 No |
Answer / brite
Even you are wrong Siva.
printf("ABC\rDE") will print DEC not DE.
Is This Answer Correct ? | 32 Yes | 16 No |
Answer / siva
above two answers are wrong.
i tested the following is the correct answer
\r is known as carriage return
e.g printf("ABC\rDE");
DE will get printed.
\b is known as back literal
e.g. printf("ABC\bDE");
ABDE will get printed.
Is This Answer Correct ? | 31 Yes | 21 No |
Answer / subh
Depends on terminal configuration
http://stackoverflow.com/questions/17236242/usage-of-b-and-r-in-c
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / mahboob ur rahman
System.out.print("mahboob\rkhan");
output:
mahboob
it will just priint mahboob
Is This Answer Correct ? | 1 Yes | 13 No |
Answer / yogita
\r is used for carriage return and \b is used for computer
baep
Is This Answer Correct ? | 18 Yes | 32 No |
Answer / v
printf("ABC\bDE");
It prints only "DE", because the printed ABC will be removed
by '\b'
Is This Answer Correct ? | 11 Yes | 28 No |
A milk carton can hold 3.78 litres of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one litre of milk is $0.38, and the profit of each carton of milk is $0.27. Write a C++ program that prompts the user to enter the total amount of milk produced in the morning. Then display the number of milk cartons needed to hold milk, the cost of producing milk, and the profit for producing milk.
What is Destructor in C++?
How do I make turbo c++ full screen?
How to allocate memory dynamically for a reference?
Write a corrected statement in c++ so that the statement will work properly. x + y=z;
Is c++ primer good for beginners?
Is set c++?
reading material is provided 3 books for c++ if u need more do let me know thnx i hve lots of material do let me know if u want it
What is ios class in c++?
How is an Abstract Base Class(ABC) related to an "Abstract Data Type" (ADT)
What is buffering in c++?
What is the difference between the compiler and the preprocessor?