c++ auto variable

#include <iostream>

int main() {
    auto x = 10;
    auto y = 20.5;
    auto z = "Hello";

    std::cout << "x: " << x << ", type: " << typeid(x).name() << std::endl;
    std::cout << "y: " << y << ", type: " << typeid(y).name() << std::endl;
    std::cout << "z: " << z << ", type: " << typeid(z).name() << std::endl;

    return 0;
}

This C++ code snippet demonstrates the use of the auto keyword to infer the data types of variables x, y, and z. The program initializes x with an integer value 10, y with a floating-point value 20.5, and z with a string literal "Hello". The typeid().name() function is used to print the types of these variables to the console using std::cout.