What is Flag ?
Today we will learn in our article what are the Flag characters in C ++ who are learning programming. They cannot understand this character. Because it looks very difficult to see. If you start to insist that we Nothing is difficult if you have to learn it. Because programming is something that only takes your time. If you practice as much as you can, then nothing is difficult. Today Tanya will tell you a lot about Flag character. I hope you will be able to explain it in an easy way after reading this article and explain it to others like me.
The number of characters in a data variable in the control string or in other words this variable. In addition to setting the width of, you use the Flag character, which affects the shape of the data output format. The flag character is written immediately after%.
( - ) ( + ) ( 0 ) ( space) ( # ) ( # )
The data in the code-variable is equal to the left. Putting the code + before the code of a signed variable will indicate the + or - sign with it. The digits of 0 will appear.
Space is to give a space before the positive quantity of a signed variable.
0 and 0 x before the system numbers of code # 8 and 16, respectively. It does this with code. The code is used to represent decimal numbers in the form of float type numbers. It only does this with codes of e, f and g. Friends, you understand the flag character. It looks very difficult to see. But after practicing on the program I am making, you will start to understand it easily. In this program, take integers and float data variables and use flags with them.
Int i= 12345;
Printf("%3d %5d %8d\ n \n",i,i,i);
Printf ("%3f %10f %13f \n\n",x,x,x);
Printf (" %3e %13e %16e",x,x,x);
12345 12345 12345
345.678000 345.678000 345.678000