×

C++ Programs

C++ Most popular & Searched Programs

C++ Basic I/O Programs

C++ Constructor & Destructor Programs

C++ Manipulators Programs

C++ Inheritance Programs

C++ Operator Overloading Programs

C++ File Handling Programs

C++ Bit Manipulation Programs

C++ Classes & Object Programs

C++ program to demonstrate example of cascading cout and cin

Learn, what is cascading cout and cin, how to use it to read and print multiple values in a single statement in C++?
[Last updated : March 01, 2023]

What is Cascading cout and cin in C++?

Simply expressed, cascading cout and cin refer to the use of several input or output operators in a single expression. This is definitely a core part of C++ programming.

In this program you will learn how to use cascading/ multiple cin and cout in c ++ programming language to print values and messages together.

Cascading cout and cin example in C++

/*C++ program to demonstrate example of cascading cout & cin.*/
#include  <iostream>
using namespace std;
 
int main()
{
    int a,b;
 
    //without cascading cout
    cout << "Enter value of a and b : ";
 
    //cascading cin
    cin >>a >>b;
 
    //cascading cout
    cout<< "A : " << a << ", B : " << b << endl;
 
    return 0;
}

Output

Enter value of a and b :10  20
A : 10, B : 20

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.