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


#include<iostream.h>
#include<conio.h>
void main()

{
clrscr();
cout<<"Welcome to C++ Programming";
cout<<"\nWelcome\nBCA\nStudents";
getch();
}

Output:


Welcome to C++ Programming
Welcome
BCA
Students

			

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