C++ Program to Print the Name of the User using Streams

This C++ Program which prints the name of the user using streams. The program asks user to input his/her name using Input Streams, the name is saved in a string variable and is printed using Output Stream. Here is source code of the C++ program which prints the name of the user using streams. The … Read more

advertisement

C++ Program to Demonstrate Use of Output String Stream

This C++ program illustrates use of output string stream. The class template std::basic_ostringstream implements output operations on memory based streams. This is used to attach stream to a string, that is we can write to it using this stream. Here is the source code of the C++ program which illustrates use of output string stream. … Read more

advertisement

C++ Program to Demonstrate Use of Input String Stream

This C++ program illustrates use of input string stream. The class template std::basic_istringstream implements output operations on memory based streams. This is used to attach stream to a string, that is we can read from it using this stream. Here is the source code of the C++ program which illustrates use of input string stream. … Read more

advertisement

C++ Program to Illustrate Logical Constness

This C++ program illustrates the illustrates logical const-ness. Logical constness comes from declaring a reference or pointer const, and is enforced by the compiler. The value referenced by the reference or pointer variable can be changed only by casting away the constness of the reference variable by using const_cast. Here is the source code of … Read more

advertisement

C++ Program to Demonstrate Use of Formatting Flags on Integer Output

This C++ program demonstrates the use of formatting flags on integer output. The formatting flags provided in the header ios_base helps to format the integer output. The integer output can be either in decimal, octal or hexadecimal format. Here is the source code of the C++ program which demonstrates the use of formatting flags on … Read more

advertisement

C++ Program to Demonstrate Use of Formatting Flags on Float Output

This C++ program demonstrates the use of formatting flags on float output. The formatting flags provided in the header ios_base helps to format the float output. The float output can be either in fixed, scientific or default format. The fixed format has fixed number of significant digits while the default one has the same number … Read more

advertisement

C++ Program to Demonstrate Usage of bind2nd Binder

This C++ program demonstrates the usage of bind2nd binder. The program binds the second parameter of the binary predicate greater and equal_to to 7. A vector of integers is instantiated and whether there is an element greater than 7 and any element equal to 7 is determined. Here is the source code of the C++ … Read more

advertisement

C++ Program to Demonstrate Usage of bind1st Binder

This C++ program demonstrates the usage of bind1st binder. The program binds the first parameter of the binary predicate greater and less to 7. A vector of integers is instantiated and whether there is an element greater than 7 and any element equal to 7 is determined. Here is the source code of the C++ … Read more

advertisement

C++ Program to Demonstrate noskipws Manipulator

This C++ program demonstrates the noskipws manipulator. The manipulator prevents skipping the whitespaces when either characters are entered into operands via input stream or characters are output into output streams. Here is the source code of the C++ program which demonstrates the noskipws manipulator. The C++ program is successfully compiled and run on a Linux … Read more

advertisement

C++ Program to Merge Two Sorted Vectors

This C++ Program which combines two sorted arrays. The program uses two user-defined functions enter_elem( ) and comb( ). The function enter_elem( ) takes number of elements of the vector as the input and runs a for loop to push elements into the vector. The vectors are then sorted and passed into the function comb( … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.