The cout object in C++ is an object of class iostream. It is characterized in iostream header record. It is utilized to show the result to the standard result gadget for example screen. It is related with the standard C result stream stdout. The information should have been shown on the screen is embedded in the standard result stream (cout) utilizing the addition operator(<<).
Program 1:
Below is the C++ program to implement cout object:
- C++
Output:
Welcome to GFG
Note: More than one variable can be printed using the insertion operator(<<) with cout.
Program 2:
Below is the C++ program to implement the above approach:
- C++
Output:
Name : Akshay
Age : 18
The cout proclamation can likewise be utilized with some part works:
1.cout.write(char *str, int n): Print the principal N character perusing from str.
2.cout.put(char &ch): Print the person put away in character ch.
3.cout.precision(int n): Sets the decimal accuracy to N, while utilizing float values.
Program 3:
Below is the implementation of the member functions of the cout.write() and cout.put():
- C++
Output:Welcome
Program 4:
Below is the C++ program to illustrate the use of cout.precision():
- C++
No comments:
Post a Comment