DEV Community

Mohammed Salah
Mohammed Salah

Posted on

C++24th Code ( define Variable by Auto )

    #include<iostream>
    #include<iomanip>
    using namespace std;
    int main()
    {
auto x=0.0 ,y=0.0 ;
cout<<" \n\tEnter The Value of  x :  ";
cin>>x;
cout<<"\n"<<endl;
cout<<" \n\tEnter The Value of  y :  ";
cin>>y;
cout<<"\n"<<endl;
    cout<<"\n\t============================\n"<<endl;
    cout<<fixed<<setprecision(2)<<endl;
cout<<" \n\tThe sum of x + y = " <<x+y<<endl;
cout<<" \n\tThe sub of x - y = " <<x-y<<endl;
cout<<" \n\tThe mul of x * y = " <<x*y<<endl;
if(y!=0)
    {
    cout<<" \n\tThe div of x / y = " <<x/y<<endl;
    }
    else
    {
    cout<<" \n\t Sorry Can't Divide on Zero = Non " <<endl;
    }
cout<<"\n\tThe size of x = " <<sizeof(x)<<"  Byte"<< endl;
cout<<"\n\tThe size of y = " <<sizeof(y)<<"  Byte\n\n"<<endl;
system("pause");
cin.get();
return 0;
    }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →