A Program to understand the use of 'cout' object :-

void main()
int length=10;




Note :-

The cout object can also be used with other member functions such as put(), write(), etc. Some of the commonly used member functions are:-

1. cout.put(char &ch): Displays the character stored by ch.
2. cout.write(char *str, int n): Displays the first n character reading from str.
3. cout.setf(option): Sets a given option. Commonly used options are left, right, scientific, fixed, etc.
4. cout.unsetf(option): Unsets a given option.
5. cout.precision(int n): Sets the decimal precision to n while displaying floating-point values. Same as cout << setprecision(n).
Previous Next