C++ Program to initialize more than one variable at a time


In this Program, You will learn How to initialize more than one variable at a time in C++.


x = y = z = 5


Example: How to initialize more than one variable at a time in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

    int x, y, z;

    x = y = z = 5;

    cout << "\nThe x value is :" << x;
    cout << "\nThe y value is :" << y;
    cout << "\nThe z value is :" << z;

    return 0;
}

Output:

The x value is :5
The y value is :5
The z value is :5